Hide "Site News" forum item from "Main menu"

Hide "Site News" forum item from "Main menu"

by Eloy Lafuente (stronk7) -
Number of replies: 7
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi.

I'm training moodle since one week ago. It's great !!

But, nothing is perfect smile and I've a question:

I've defined my site to show five news at the main page (like moodle.org website). But a "Site News" forum item is shown at "Main Menu".

I've tried to delete it (admin mode and delete) but it returns automatically.

How can I hide it forever ?

TIA.
Average of ratings: -
In reply to Eloy Lafuente (stronk7)

Re: Hide "Site News" forum item from "Main menu"

by Claudio Tavares -
Hi, It's very strange, can I see you site?
Anyway, in "activate edition" (activar edición) you can delete this forum from Main Menu.
In config page (configurar página) you can also choose to show a course list instead a news forum.
I hope this help.
In reply to Claudio Tavares

Re: Hide "Site News" forum item from "Main menu"

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
I've tried to delete the forum from my administrator accout, then a confirmation dialog apears. I push yes and then I return to the main page. The "Site News" item seems to go away, but, when I logout it returns...

I want a main page with news (4 or 5) on it, but I don't want the "Site News" item in the main menu (just like www.moodle.org).

My testing site is http://www.contiento.com/elearn

There you can see the "site news" menu item (at the left), and it's unerasable!!!

Ciao & TIA
In reply to Eloy Lafuente (stronk7)

Re: Hide "Site News" forum item from "Main menu"

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Yes, this is actually normal.

The main menu block there is called "section 0", and is the default location for the news forum when it is created (same as in the the courses, where section 0 is the very top section).

Older versions of Moodle stored the News forum in section 1 (which is invisible on the site page) - so people who have been upgrading (like Claudio and me smile) will not have this same problem you're having.

Eventually there should be some way of solving this, but a desperate hack you could try now is to edit mod/forum/lib.php, looking for this line:
    $mod->section = 0;

in the function forum_get_course_forum(), and change it to:
    $mod->section = 1;

Save the file, then delete your News forum again and refresh the site page. Voila!

Then go back into the file again and undo your change to that line.

There is another way to do this by editing the database tables directly (course_sections and course_modules) but it's a little easier to muck things up that way.
In reply to Martin Dougiamas

Re: Hide "Site News" forum item from "Main menu"

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi.

Thanks, Martin.

I saw your last paragraph and I went to the database (to see the real structure). I looked for the "Site News" forum id, and then update the "sequence" field in "course_sections" to erase it.

That seems to work fine. Thanks.

But thinking a bit....Is not a little strange (and limited) the use of the "sequence" field ?. I think that it'll better if you decouple that information (items per section) to anoher relational table.

It's only an idea. Sorry for my daring... smile
In reply to Eloy Lafuente (stronk7)

Re: Hide "Site News" forum item from "Main menu"

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
You should update course_modules too (it has a back pointer to the section - you may have problems later otherwise).

I find the sequence field is a very efficient way of storing ordered items for processing by PHP. Otherwise you have to maintain linked-lists, or manual indexes, which are complex and slow ... etc etc. The size is being increased in 1.0.9 too. Don't worry about it. wink
In reply to Martin Dougiamas

Re: Hide "Site News" forum item from "Main menu"

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
There is something that seems to be wrong.

As I said in my previous post, I updated course_sections (the couse 1, section 0) exactly the field "sequence" to erase from the list the news forum.

In your last post you said me that i should update course_modules too. But there, the "news" section is "1", not "0".

I've dropped the database and installed it again to see the initial status.

Now I've a record in course_sections (course 1, section 0) with only one volue on "sequence".

In course_modules, I've only one record too, but their section is 1 (no 0).

Pherhaps a mistake ? What section I've to put (update) on course_modules ?

TIA, again.
In reply to Eloy Lafuente (stronk7)

Re: Hide "Site News" forum item from "Main menu"

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Remember earlier, how I said "it's a little easier to muck things up that way"?