In my main menu I have a "menu item 1" that links to mynode1.
I have successfully implemented hook_permission()
and hook_node_access()
so that users who do not have the "access menu item 1" permission cannot access mynode1.
I assumed that the menu item link "menu item 1" would automatically be hidden by Drupal, but this is not the case. Therefore I now would like to hide that menu item to users who do not have "access menu item 1" permission.
Does anyone have a code sample that would hide a menu link based on permission? (I tried hook_menu_alter()
with no luck.)