1

The problem is when a menu item points to a restricted page, the anonymous user can't see the menu link.

So I was looking for a way to setup a path alias so it would point to two internal path => one for anonymous and one for logged users.

Is this solution possible? Do you see another way to show restricted menu item to guests ?

2

2 Answers 2

3

You cannot have one alias for two items. That's not how router works. On the other side, you can create a page only guests will have permission to see, and place it under the same name in the same menu. Then both guests and logged in users will see identical menu, but they will actually get different set of menu items.

If that's not enough, you can use Menu per Role to get more control of who sees what in your menus.

2
  • I am going to try this, it seems to be the proper way to do it.
    – B2F
    Commented Jun 4, 2013 at 9:12
  • 1
    fixed it with a hook_menu and $items['path/to/page']['access callback'] = 'user_is_anonymous'; thanks
    – B2F
    Commented Jun 4, 2013 at 15:40
1

If you want to display a menu item for a page that the user does not have access to, the easiest way is to enter the full URL into the menu item rather than the path. Drupal doesn't check such items for access. The only downside is that the URL won't be automatically maintained by Drupal, so it won't work across domains for example.

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.