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.

Is it possible to let a non-admin user (e.g an editor / author or another role) manage the users? I am working on a Wordpress website where multiple people manage the website, and there will be someone who must be able to manage the users, but does not need access to all the admin features.

Thanks.

share|improve this question

migrated from stackoverflow.com Jul 2 '11 at 12:48

This question came from our site for professional and enthusiast programmers.

add comment

3 Answers 3

up vote 2 down vote accepted

First off, there is no generic "manage users" ability. There are several individual abilities under that rubric. See http://codex.wordpress.org/Roles_and_Capabilities

Anyway, you have a couple options.

  1. You can add certain capabilities to existing users or
  2. you can create a new custom role with the capabilities you need.

If a brand new role is needed, one can be created using add_role() and add_cap():

$role = add_role('foo_doer', 'Foo Doer');

$role->add_cap('do_foo');

$role->add_cap('do_bar');

If you want to manipulate a user specifically:

// get user by user ID
$user = new WP_User( $id );

// or get user by username
$user = new WP_User( null, $name )

then

// add $cap capability to this role object
$role_object->add_cap( $capability_name );

That's the basics. A full and elegant rundown is here: http://www.garyc40.com/2010/04/ultimate-guide-to-roles-and-capabilities/

share|improve this answer
1  
Its a shame of the current user system is that a person can only have 'one role' it would be easier if a person could have multiple roles so you could combine features a user has access to. –  Matthijn Jul 1 '11 at 20:13
    
@Matthijn: I think you misunderstand. You can do that. You can make a custom role that has any of the capabilities. You can combine of make new roles as you see fit. –  two7s_clash Jul 1 '11 at 20:15
    
Yes, you can combine roles like the ACL principle. However it would be handy if you could just check on a user page like 'you can do this, this and this'. –  Matthijn Jul 1 '11 at 20:17
    
@Matthijn: ok, I think the plug-in in the first answer can do that sort of thing. That's probably a better answer for you if this one doesn't seem so handy. FWIW, I think solutions like that add to plug-in bloat and slow sites. Always a best practice to do this sort of thing directly if you know how. –  two7s_clash Jul 1 '11 at 20:22
    
It will be coded, but the approach on how it is handled, I think it is a bit clumsy. It would be easier to do something like have a few 'main roles' (like now) but be able to define per user criteria $user->add_capability('edit_users'); or something like that, instead of having to create a role based on another role. Because if there are allot of users who all should be able to do something just different than the other you must create and 'subclass' a lot of roles. –  Matthijn Jul 1 '11 at 20:25
show 2 more comments

Yes, that is possible.

For a user to be able to see the list of other users in wp-admin, he or she needs the capability list_users, to be able to edit existing profiles, he or she needs edit_users, to add new ones add_users and to delete old ones delete_users.

For managing a site with multiple specific user roles that need to have certain capabilities and not to have others, I highly recommend using a mixture of two plugins:

Adminimize gives you control over what part of the admin interface is shown to what role

Members lets you edit the capabilities of a specific role and add new roles as needed

share|improve this answer
add comment

Yes, this is very possible and quite simple.

You will want to use the RoleScoper plugin to enable extra permissions for the "Editor" role or even create an entirely new Role to manage users. It's a very easy plugin to use and well-documented on its web site.

share|improve this answer
add comment

Your Answer

 
discard

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