How to show a menu for everybody but one role? I'd like to add, in a custom module, a hook menu that adds a menu only if


the user is logged in
the user has the role "immat"


I'm trying to use the hook_menu() hook but it's never called when the page displays the "Navigation" menu.
Where should I look / which hook should I use?

Thank you very much!
hook_menu is not called on every page load, because that make Drupal really slow. It is only called when the menu is being (re)built, and the resulting menu structure is cached.

In hook_menu, you can tell Drupal how to determine which users have access. Access is not granted by role, but by permission. That way, you can easily grant the same permission to other roles when needed.

You will need to:


Define a new permission using hook_permission
Add the new permission to the role you want to give access
Restrict your menu item to users with that permission by adding 'access arguments' =&gt; array('[name of your permission]'), to your menu item


For an example, see the menu_example module at api.drupal.org. More specifically, see how menu_example_permission defines a new permission and how menu_example_menu specifies that permission as access arguments for the $items['menu_example/permissioned/controlled'] item.