最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

How to create a specific role to manage users

matteradmin6PV0评论

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.

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.

Share Improve this question edited Apr 14, 2019 at 1:10 Frank P. Walentynowicz 3,4042 gold badges19 silver badges20 bronze badges asked Apr 13, 2019 at 15:37 dsjdsj 638 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

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.

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far