Hiding a menu item on Site Administration

Hiding a menu item on Site Administration

by Richard French -
Number of replies: 0

On our Moodle site, we have the need for several customized roles. Everything has worked well limiting access to various parts of the site using modified roles and capabilities. However, due to specific requirements, I've had to enable  moodle/role:assign. Which means a user with a particular role sees the following Site Administration menu:



Question: how do I hide Permissions? This is what my local_extend_settings_navigation looks like now:

function local_name_extend_settings_navigation(settings_navigation $settingsnav, context $context) {

    global $USER, $PAGE, $CFG;

   require_once($CFG->libdir. '/navigationlib.php');

   require_once($CFG->libdir . '/adminlib.php');

   if ( !is_siteadmin($USER->id)) {

      $frontpagenode = $settingsnav->find('frontpage', null);

      $frontpagenode->remove();

    }

}

The 'Front page settings' menu item get removed from the menu just fine. I can't seem to find anything to search on (like 'frontpage' above) that works. I think it's a combination of the Permissions menu item is hidden when I search and it's an external administration page (just my guesses of course). 

Follow-on question: If removing Permissions in the menu above is not feasible for some reason, how could I remove 'Assign system roles' and 'Check system permissions'?

Any ideas?

Many thanks in advance,

Richard

Average of ratings: -