Drupal, Hide Menu Item by User Role

Q: How can I arrange for the visibility of certain menu items to change based on the logged-in user?
A: Use the most excellent 'Menu per Role' module and then configure your menu item's settings in the 'Restrict access permission' section.

If you want to restrict certain menu options for a group of users first add a new user role (/admin/user/roles) and add the users in question to it (if you haven't already!). Now install the 'Menu per Role' module, this will allow you to configure menu premissions on a user role basis (and therefore on a user basis).

To configure a menu item's permissions, edit its settings, and in the 'Restrict access permission' section select the user roles that should have accss to the menu option - once configured other users will never see the menu item at all.

By default all roles have access to all of the menus so you only have to update the menu items from which you want to restrict to certain roles and users.

Stranger
Stranger's picture
awesome!

awesome!

Stranger
Stranger's picture
Thank you so much!

This is a great workaround to a bug in drupal that results in menu items that are inaccessible yet still visible.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can use BBCode tags in the text.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.

Pride on FacebookPride on TwitterPride on TwitterPride on Twitter

Join Our Newsletter

* indicates required

Irish Internet Association

finalist.png
phone-number.png