1

I have a regular node in my main menu that:

  1. if an anonymous user clicks on it, the node should be shown regularly
  2. if a logged in user clicks on it, there should be a redirect to an external website

I tried

HOOK_menu_link_alter but that only is invoked on edit-and-save (if menu item is created via web)

HOOK_node_view that seems to work but does not seem like a good solution to load the complete node and check for the user just to redirect

1 Answer 1

0

Instead of altering the menu link per role (which is tricky considering the process with which menus are built and cached), I would suggest you go for adding redirects per role.

The Url Redirect module should be able to help you achieve it.

  • Url Redirect is a simple, flexible module for allowing user(s) / role(s) to redirect from one path to other.
  • Url Redirect is also handy to add / edit / delete url(s) , specify role(s) / user(s) for url redirect, set a message for url redirect, enable / disable.

Your Answer

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

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