I want to hide hybridauth tab in user page. I have used $items['user/%user/hybridauth']['access callback'] = FALSE; in hook_menu_alter() which gives the result, but hides for all user. In my case I Want hybridauth tab to hide for all user except admin.

2 Answers 2


The module uses the following definition for that menu item.

  $items['user/%user/hybridauth'] = array(
    'title' => 'HybridAuth',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('hybridauth_user_identity', 1),
    'access callback' => 'user_edit_access',
    'access arguments' => array(1),
    'file' => 'hybridauth.pages.inc',
    'type' => MENU_LOCAL_TASK,

Simply changing the access arguments, as suggested by Andrew, doesn't work because the access callback used by that module is expecting an user object as argument, while with his solution you would give that callback a string, with all the effects.

To answer your question, it all depend from what you mean by admin user.

If you mean the user whose ID is 1, then use the following code.

$items['user/%user/hybridauth']['access callback'] = 'user_access';
$items['user/%user/hybridauth']['access arguments'] = 'administer user hybridauth';

I used a permission none of the other modules defines, so that nobody will have it assigned. Don't assign that permission, and only the user #1 will be able to see that menu item.

If you mean a user with a specific role, then use the same code I already shown, but assign that permission to the role the admin user has.

In both the cases, the module needs to implement hook_permission() too, since the code I shown uses a new permission.

  • This solution also works for me
    – Vamsi
    Jul 9, 2015 at 5:46

Can you try this solution?

$items['user/%user/hybridauth']['access arguments'] = array('administer site configuration');

  • Working but this too hides the tab for admin user
    – Vamsi
    Jul 9, 2015 at 5:20
  • It's weird. Did you delete $items['user/%user/hybridauth']['access callback'] = FALSE; and cleared caches?
    – Andrew
    Jul 9, 2015 at 5:32
  • It is not weird. You cannot simply change the access arguments without changing the access callback, since the access callback could be any function, including one not expecting a string as argument.
    – apaderno
    Jul 9, 2015 at 5:35
  • @Andrew Its working now.
    – Vamsi
    Jul 9, 2015 at 5:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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