I have a views page with a menu tab in user profile, I want to hide it for some user roles.
I tried with hook_menu_alter
function hide_tabs_menu_alter(&$items) { global $user; if (in_array('gerant', array_values($user->roles))) { $items['user/%user/infos']['type'] = MENU_CALLBACK; } } - This doesn't hide the tab, but it works for other tabs -created by other modules- like user/%user/contact.
- I wanted this user still be able to see this tab in other users profile.
To add more information
( @kiamlaluno sugguested me to use with views permissions instead of hook_menu_alter)
There There are two roles (gerant and etudiant). The permission should be View own info page which should be assigned to etudiant. gerant should not have it, but it should still be allowed to see user/%user/infos in etudiant's profiles.