I have a super user(user 1) that I want to hide in people list (mysite.com/admin/people).

Is there anyway to filter it out? I couldn't find a hook unless I just missed it. I know I could create my own view and easily filter it but then I loose the bulk operation which I need to keep.

EDIT: here is the "why". I'm building an intranet system with drupal. User 1 is the super user that I want to keep for myself to be able modify advanced features of the intranet. I have created another "admin" roles that can manage content, users, roles, etc. I have a few dozen modules installed, but the ones applicable per this issue is user protect, workbench, and permissions lock.

There is a bug in user protect that allows my admin to delete the user1 account via the bulk operations on the people page, so I want to just hide it altogether.

  • There is no hook to remove an item from the People list. Telling us why you want to do this may help us providing you with a suitable workaround answer. Jun 7, 2014 at 2:01

5 Answers 5


Put this in a custom module and it will effectively remove User 1 from the People list, but only there.

 * Implements hook_form_FORM_ID_alter().
function mymodule_form_user_admin_account_alter(&$form, &$form_state, $form_id) {

But as Free Radical pointed out, if you say why there might be better solutions.


  • hi enzipher, thanks so much for you response. I tried this but it has no effect, user1 still appear in the people list at mysite.com/admin/people. I am new to module development so maybe I missed something? Jun 11, 2014 at 18:41
  • If you added this, I think you would need to clear your site cache before it would take hold. Mentioning that because you said you are new to module development...
    – DragonYen
    Jun 11, 2014 at 19:39
  • yeah tried that already, no effect. thx Jun 11, 2014 at 20:31
  • @EricDouglas If it doesn't work there must be something else off with your module. There is a lot that can go wrong with that so I would suggest you look up module development. It might also work to put this snippet in your theme's template.php file, just make sure you rename the hook to themename_form_user_admin_account_alter (where "themename" is the actual name of your theme, e.g. "bartik").
    – dxc
    Jun 11, 2014 at 21:50
  • I'm a bit confused, I added: print_r($form_id . "<br>"); and the name of the forms for the people list are: views_exposed_form and views_form_admin_views_user_system_1, so just to be clear, the code you provided is supposed to remove the row (<tr>) from the people list? Jun 12, 2014 at 0:45

The User One module insert automatically superaddmin hidden

  • User one account is protected from viewing and editing. Users -- even with 'Administer users' permission -- will be denied access.
  • User one account is hidden from user listing page, admin/people.
  • User one account is hidden from user lists such as in blocks, Who's New and Who's Online. User One provides its own version of Who's
    Online block for correct count of logged in users besides hiding user one.
  • User One exposes Drupal's built-in values to change otherwise inaccessible such as number of allowed login attempts and time window to remember such login attempts.
  • While Drupal temporarily deny login after multiple failed logins, User One goes one step further to allow permanently block such IPs
    automatically and notify the site admin.

IF all else fails, you can hack core:


change part of function user_admin_account()

if($account->uid != 1) // add if statement
  $options[$account->uid] = array(
  'username' => theme('username', array('account' => $account)),
  'status' =>  $status[$account->status],
  'roles' => theme('item_list', array('items' => $users_roles)),
  'member_for' => format_interval(REQUEST_TIME - $account->created),
  'access' =>  $account->access ? t('@time ago', array('@time' =>     format_interval(REQUEST_TIME - $account->access))) : t('never'),
  'operations' => array('data' => array('#type' => 'link', '#title' => t('edit'), '#href' => "user/$account->uid/edit", '#options' => array('query' => $destination))),
  • Never hack core and Why don't we hack core. Jun 7, 2014 at 2:05
  • thanks for the response, but if all else fails I think I would prefer to remove it via jQuery; not perfect but hacking core of any platform can lead to future nightmares. Jun 11, 2014 at 18:44
  • The only problem with that is, it can be overcome by turning off javascript on the browser - hardly secure. Enzipher's answer is probably the best option if it works as required - but there is nothing wrong with hacking core, so long as it is done properly and documented. The biggest argument against it seems to be updating and upgrading - but if it's done properly and documented well, that shouldnt be a problem. Most people are too lazy to do it properly, so it's advocated as evil in the Drupal community.
    – Geoff
    Jun 11, 2014 at 19:32

Taking inspiration from user_filter_form and user_filter_form_submit functions in user.admin.inc :

From a custom module's init hook, add a filter for user_overview_filter if current page is admin/people. Set into sesssion variable like this:

$_SESSION['user_overview_filter'][] = array('filter_name_maybe_username', 'superadmin');

You might also want to use label 'Filter' instead of 'Reset' if the only filter available is your custom filter. Similar logic can be applied for VBO form.

Let me know if it helps.


Hiding admin user is not enough.because by this url (user/1/edit) it would be accessible.you should change access permission by calling hook_menu_alter here is a simple code for you : now it dose not important if others can see admin on people page.because they cannot edit it.

tips: change MODULENAME with name of your module.

 * Impelement hook_menu_alter
 * @param array $items
function MODULENAME_menu_alter(&$items) {
    $items['user/%user/edit']['access callback'] = 'MODULENAME_change_premission';

function MODULENAME_change_premission($account) {
    global $user;
    //check if account is admin and person trying to edit is not admin
    if ($account->uid == 1 && $user->uid != 1) {
        return FALSE;
    } else {
    // return default access premission
        return user_edit_access($account);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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