Hide tab created by views if user has a specific role 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(&amp;$items) {
    global $user;
    if (in_array('gerant', array_values($user-&gt;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

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.
Finally it worked for me using hook_menu_local_tasks_alter(), thanks to drupal developers community.

function hide_tabs_menu_local_tasks_alter(&amp;$data) {
  if (arg(0) == 'user' &amp;&amp; is_numeric(arg(1))) {
    $uid = arg(1);
    $account = user_load($uid);
    if (in_array('gerant', array_values($account-&gt;roles))) {
      foreach ($data['tabs'][0]['output'] as $key =&gt; $value) {
        if ($value['#link']['path'] == "user/%/infos") {
          unset($data['tabs'][0]['output'][$key]);
        }
      }

    }
  }
}