1

I have a navigation menu in a menu block. I want some of the links in the menu to be hidden if user doesn't have role xxx.

What is the best way to do so?

3 Answers 3

3

The best way to do it would be simply to restrict access to those pages to only the roles you wish to be able to see them. The menu system will automatically not print out links for pages the user cannot access.

How to do this depends on what you're linking to. If it's nodes, perhaps the core per-content-type permissions are enough. If not, there is a variety of node access modules you can use to implement more fine-grained node access, using taxonomy or other methods. If those pages are Views, you can set a View to only be available for certain roles.

1

If you are running D6, http://drupal.org/project/menu_per_role is a great way to go, alas, from its documentation, it's not yet running very well on D7.

1
  • Sorry, forgot to mention, using D7
    – gilzero
    Commented Mar 16, 2012 at 23:57
0

Use the Menu Per Role module - even though it's DEV it works great on my Drupal 7 sites. It allows you to define the user roles allowed to see each menu item. You either define for which user roles to show it, or for which roles to hide it. For other roles, it stays with the default. Here is a screenshot of the settings screen:

Menu item settings screen

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.