Hide "Forum Posts" under "My Profile"

Hide "Forum Posts" under "My Profile"

by Scott Sander -
Number of replies: 1

We have essentially completely disabled forums in our environment and now want to remove "Forum Posts" under the "My Profile" section of the main navigation block. If a user tries to click either of the settings there they just get an "Error reading from database" error.

How do I hide access to those links?

Average of ratings: -
In reply to Scott Sander

Re: Hide "Forum Posts" under "My Profile"

by Matthew Miller -

I went into the user/tabs.php file and commented out the section relating to Forums and Blogs.  In our copy (version 1.9.13+) if you searched for "user:readuserposts" you'd jump to the right section.  I've copied what we did, below, so you can see it.  This just removes the tabs, no other functionality is affected.

 

    /// Everyone can see posts for this user

/// add logic to see course read posts permission

/******** REMOVED TEMPORARILY UNTIL WE CAN HIDE FROM PARENTS - Matthew Miller 20110923 ***********

if (has_capability('moodle/user:readuserposts', $personalcontext) || has_capability('mod/forum:viewdiscussion',
get_context_instance(CONTEXT_COURSE, $course->id))) {
$toprow[] = new tabobject('forumposts', $CFG->wwwroot.'/mod/forum/user.php?id='.$user->id.'&course='.$c$
get_string('forumposts', 'forum'));

if (in_array($currenttab, array('posts', 'discussions'))) {
$inactive = array('forumposts'); $activetwo = array('forumposts');

$secondrow = array(); $secondrow[] = new tabobject('posts', $CFG->wwwroot.'/mod/forum/user.php?course='$
'&id='.$user->id.'&mode=posts', get_string('posts', 'forum')); $secondrow$
tabobject('discussions', $CFG->wwwroot.'/mod/forum/user.php?course='.$course->id.
'&id='.$user->id.'&mode=discussions', get_string('discussions', 'forum'));
}

}
     ********** END REMOVE **********/