0

How can I change my menu items depending on whether the user is logged in or not? For example, I would like my secondary navigation to have a "sign in" link if the user isn't authenticated and "log out" if the user is authenticated.

Thanks! Jane

2 Answers 2

1

Drupal's menu system checks the permissions of menu items that it connects to. So, depending on the permissions of your content you could use the same menu for users with different roles. Also if you use the path "user/login" in a menu and name it "Sign in" it will only show up when users are logged out. Similarly a menu item with "logout" as the path will only show up when a user is logged in.

1
  • I totally agree more with this direction. AKAIK the only thing that cannot be achieved is a "My Account" link. This will end up being displayed for both anon and logged in users leading to some confusion. I know the question asker did not ask this part, however, it seems like it would be a reasonable assumption that this will be needed as well. @acouch, do you know of a way to achieve this with the method you are describing?
    – user842
    Commented Aug 9, 2011 at 15:02
3

Check out Menu per Role Module. This module allows you to restrict access to menu items based on user roles. Once enabled, there will be a new fieldset that allows you to restrict access by role. The fieldset also appears in the node edit form.

0

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.