How can I configure the User Protect module to avoid editing/deleting users with "edit users" permissions? I am working in Drupal 6. I have created a role "admin users" with permissions for edit and delete users but I need that this role "admin users" cannot edit/delete the user admin. I have installed the User Protect module but I cannot to configure it correctly for the role "admin users" can not modify it.
I had to do it one day and I did like that. But in my case the permission is edit user 1. The code simply remove the user from the list. Feel free to change as you want.

&lt;?php
function mymodule_menu_alter(&amp;$items) {
  $items['admin/user/permissions']['access callback'] = 'mymodule_user_access';
}

function mymodule_user_access($string, $account = NULL, $reset = FALSE) {
  if ($string == 'administer permissions' &amp;&amp; user_access('edit user 1')) {
    return TRUE;
  } else {
    return FALSE;
  }
}

function mymodule_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  $form['#validate'][] = 'mymodule_user_profile_form_validate';
}

function mymodule_user_profile_form_validate(&amp;$form, &amp;$form_state) {
  $account = $form_state['values']['_account'];
  if(!user_access('edit user 1') &amp;&amp; $account-&gt;uid == 1) {
    form_set_error('category', t('You does not have right to edit this user.'));
  }
}

function mymodule_perm() {
  return array(
    'edit user 1',
  );
}

function mymodule_theme() {
  return array(
    'mymodule_user_admin_account' =&gt; array(
      'arguments' =&gt; array('form' =&gt; NULL),
    ),
  );
}

function mymodule_theme_registry_alter(&amp;$theme_registry) {
  unset($theme_registry['user_admin_account']['file']);
  $theme_registry['user_admin_account']['function'] = 'theme_mymodule_user_admin_account';
  $theme_registry['user_admin_account']['include files'] = array();
  $theme_registry['user_admin_account']['theme path'] = drupal_get_path('module', 'mymodule');
  $theme_registry['user_admin_account']['theme paths'][] = drupal_get_path('module', 'mymodule');
}

function theme_mymodule_user_admin_account($form) {
  // Overview table:
  $header = array(
    theme('table_select_header_cell'),
    array('data' =&gt; t('Username'), 'field' =&gt; 'u.name'),
    array('data' =&gt; t('Status'), 'field' =&gt; 'u.status'),
    t('Roles'),
    array('data' =&gt; t('Member for'), 'field' =&gt; 'u.created', 'sort' =&gt; 'desc'),
    array('data' =&gt; t('Last access'), 'field' =&gt; 'u.access'),
    t('Operations')
  );

  $output = drupal_render($form['options']);
  if (isset($form['name']) &amp;&amp; is_array($form['name'])) {
    foreach (element_children($form['name']) as $key) {
      if(!user_access('edit user 1') &amp;&amp; $key == 1) {
        unset($form['accounts'][$key]);
        unset($form['name'][$key]);
        unset($form['status'][$key]);
        unset($form['roles'][$key]);
        unset($form['member_for'][$key]);
        unset($form['last_access'][$key]);
        unset($form['operations'][$key]);
      }

      $rows[] = array(
        drupal_render($form['accounts'][$key]),
        drupal_render($form['name'][$key]),
        drupal_render($form['status'][$key]),
        drupal_render($form['roles'][$key]),
        drupal_render($form['member_for'][$key]),
        drupal_render($form['last_access'][$key]),
        drupal_render($form['operations'][$key]),
      );
    }
  }
  else {
    $rows[] = array(array('data' =&gt; t('No users available.'), 'colspan' =&gt; '7'));
  }

  $output .= theme('table', $header, $rows);
  if ($form['pager']['#value']) {
    $output .= drupal_render($form['pager']);
  }

  $output .= drupal_render($form);

  return $output;
}