0

I am using the Menu block module to create menu blocks and have them attached to the menu in Drupal 7. I am also using the Context module to display the menu and items on different pages.

I have a certain menu item that I want only to be visible with certain user roles. I have created a context for the page (based on "path") that linked to the menu item and have selected the administrator role as a condition and selected require both (path and user role).

Using a non-admin test user I can still see the menu item (It should be hidden). When I click on it the page content doesn't show but the menu item is still visible to the user.

How do I use Context to hide the menu item as well.

Thanks in advance

1 Answer 1

0

you could hide it programatically

function YOURTEMPLATE_menu_alter(&$items) {

 global $user;

  if (in_array('anonymous user', $user->roles)) {
  unset($items['user/%user/profile']);   // example link
  }

 }

This will hide that menu item for anonymous users.

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.