-
Improvement
-
Resolution: Fixed
-
Major
-
2.0
-
Any
-
MOODLE_20_STABLE
-
MOODLE_22_STABLE
-
wip-
MDL-27058-master -
This issue is related somewhat to issue MDL-26967 which appears to be fixed by PULL-562. Also, see this (and other) forum posts: http://moodle.org/mod/forum/discuss.php?d=171315
I believe the Forum links are confusing for the user when the capability is not present 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 suggested patch that does that for 2.X:
Replace 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'))));
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))
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')))); }}
Peace.