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.
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.
- You can add certain capabilities to existing users or
- 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/