I have created a non-admin user role to manage users. I have given this role the following capabilities: Create User, Delete User, Edit User, List Users, list roles. A member with this role CAN create a new user. However when they list Users from the dashboard, they cannot edit any users. They do not get a edit button. I am using the "members" plugin to mange roles, although I see the same results when I set the capabilities programatically. I really don't want the user manager to be a full admin.
1 Answer
The following capabilities are needed to fully manage users:
create_users
edit_users
promote_users
delete_users
remove_users
list_users
Remove role, you've created with Members plugin. Add the following code to functions.php
of your active theme:
add_role(
'users_manager',
__( 'Users Manager' ),
array(
'read' => true,
'list_users' => true,
'promote_users' => true,
'remove_users' => true,
'edit_users' => true,
'create_users' => true,
'delete_users' => true,
)
);
Once 'users_manager' role is created, you can remove above code from functions.php
.
-
I found the users that had this role also had another custom role, which explicitly denied Promote Users, Remove, Users and Edit uses. (but granted create uses) As deny overrides Grant, they were locked out. At your suggestions I have updated my 'on Activation' script where the role is created to add all of the above. I was able to fix both the grant and deny capabilities with the MEMBERS plugin.– dsjApr 14, 2019 at 15:10