How to remove the ADD USER in the "admin users area" in Drupal 7

475 views Asked by At

I already did the admin only register but I would like to remove this tab if anyone can help meenter image description here

Thanks

2

There are 2 answers

0
MilanG On

In admin menu, under People -> Permissions (/admin/people/permissions) you can set permissions for every user role. Under the "User" permissions group there is permission "Administer users". I believe that's the one you should disallow and this button won't appear for specific role.

You can also use CSS to hide that link, but it wouldn't be very clean way...but it's an option B.

0
TheodorosPloumis On

First of all this link is an Action Link which is a menu item. There are a lot of methods to hide it. Here are some suggestions.

1) On a custom module alter the menu that displays the link (with hook_menu_alter. The code to do this should be something like this:

function MYMODULE_menu_alter(&$items) {
  // Check current user is not User 1 (admin)
  global $user;
  if ($user->uid !== "1") {
    // Disable the link of admin/people/create
    $items ['admin/people/create']['access callback'] = FALSE;
  }
}

More specific alters can be done with hook_menu_local_tasks_alter function. Also some modules may do this from a UI such as Tab Tamer but haven't tried it.

2) Use the Administration Views module that overrides this view and remove the link from the views UI.

3) Use common Views module to do the same as above. Notice that you have to create that page with the same url (admin/people)

4) There are some more complex solutions with permissions by role such as the module Administer Users by Role but it may be too much for your simple case.