Remove "Forum Posts" from Navigation Menu

Remove "Forum Posts" from Navigation Menu

by Jeff P -
Number of replies: 3

I'm using the Fusion theme with a new installation of Moodle 2.0.2. I'm wondering if there's a way to remove the "Forum Posts" link (and the "Posts" and "Discussions" sublinks) from the Navigation menu. I've disabled the Forums as best I can and I feel having the links there will be confusing to students.

Average of ratings: Useful (2)
In reply to Jeff P

Re: Remove "Forum Posts" from Navigation Menu

by David Upson -

I agree that the links are confusing and results in multiple questions from students and guests asking how to use the forums. Disabling "See all user posts" (moodle/user:readuserposts) and "View discussions" (mod/forum:viewdiscussion) under "Site administration->Users->Permissions->Define roles->[Role]" should remove these options from the navigation block.

Here is a patch that does that for 2.X:

Find the following code within "/lib/navigationlib.php":


// Add nodes for forum posts and discussions if the user can view either or both
// There are no capability checks here as the content of the page is based
// purely on the forums the current user has access too.
$forumtab = $usernode->add(get_string('forumposts', 'forum'));
$forumtab->add(get_string('posts', 'forum'), new moodle_url('/mod/forum/user.php', $baseargs));
$forumtab->add(get_string('discussions', 'forum'), new moodle_url('/mod/forum/user.php', array_merge($baseargs, array('mode'=>'discussions'))));



and replace it with this code:


// Add nodes for forum posts and discussions if the user can view either or both
$context = get_context_instance(CONTEXT_USER, $USER->id);
if ($iscurrentuser && (has_capability('moodle/user:readuserposts', $context) || has_capability('mod/forum:viewdiscussion', $context))) {
$forumtab = $usernode->add(get_string('forumposts', 'forum'));
if (has_capability('moodle/user:readuserposts', $context)) {
$forumtab->add(get_string('posts', 'forum'), new moodle_url('/mod/forum/user.php', $baseargs));
}
if (has_capability('mod/forum:viewdiscussion', $context)) {
$forumtab->add(get_string('discussions', 'forum'), new moodle_url('/mod/forum/user.php', array_merge($baseargs, array('mode'=>'discussions'))));
}
}



Then, make sure your permissions are set up correctly. You can check them for an individual user at "Site administration->Users->Permissions->Check system permissions->[Select a user]." I hope that helps.

Peace.

P.S. Added to Tracker: MDL-27058

Average of ratings: Useful (2)
In reply to David Upson

Re: Remove "Forum Posts" from Navigation Menu

by Sebastian Henze -

I did that:

Disabling "See all user posts" (moodle/user:readuserposts) and "View discussions" (mod/forum:viewdiscussion) under "Site administration->Users->Permissions->Define roles->[Role]" should remove these options from the navigation block.

 

But I still can see Posts and Discussions in the Navigation Block. I'm using 2.5.