Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

How can I hide one admin from another in the users list? I want to give admin permission to another person without giving him the ability to see/edit my details.

share|improve this question
    
If the answer below fit your needs, give it an up-vote or a check-mark if it is the method you used. Check-marking a vote means you have accepted it as an Answer to your question. If you accept a low percentage of answers to your questions, people will be less likely to help you. –  Travis Pflanz Apr 20 '12 at 15:33
add comment

2 Answers

add_action('pre_user_query','yoursite_pre_user_query');
function yoursite_pre_user_query($user_search) {
  global $current_user;
  $username = $current_user->user_login;

  if ($username == '<USERNAME OF OTHER ADMIN>') { 
    global $wpdb;
    $user_search->query_where = str_replace('WHERE 1=1',
      "WHERE 1=1 AND {$wpdb->users}.user_login != '<YOUR USERNAME>'",$user_search->query_where);
  }
}

Replace text with the actual usernames of the users involved. You can also modify this to hide one admin from all other users (except him/herself), or based on user IDs or roles. For WordPress 3.1+.

share|improve this answer
add comment

My favorite method for this is to use the "User Role Editor" plugin - http://wordpress.org/extend/plugins/user-role-editor/

The plugin allows you to add more abilities to user roles, or create new user roles based on default Wordpress roles.

For example, if you do not really use the Wordpress user role of Editor, you can give another person the role of Editor, then go into the "User Role Editor" and assign them all of the Admin capabilities, however, they will not be able to see you as a user to edit, because your role is higher than theirs.

If you also use the Editor role, you can create a new role based off the default Editor role, then give it additional capabilities and they still won't be able to see you as a user to edit because your role is higher than theirs.

To me, this is the most easy to use of all the user role editing plugins, plus the developer always replies to questions and recommendations.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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