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.
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.
Can you try this solution?
$items['user/%user/hybridauth']['access arguments'] = array('administer site configuration');