简体   繁体   English

WordPress用户角色,那只能编辑具有其他用户角色的用户?

[英]Wordpress user role, that can only edit users with another user role?

I created a new user role, but I need this user role to only be able to edit users with another user role, I do not want this new user role to be able to edit users like, editors, author, etc... 我创建了一个新的用户角色,但是我需要该用户角色才能仅编辑具有另一个用户角色的用户,我不希望该新用户角色能够编辑诸如编辑者,作者等用户。

Ideas? 想法?

you can add roles so: 您可以添加角色,以便:

   $result = add_role(
        'editor_of_users',
        __( 'Editor of Users' ),
        array(
           'edit_users' => true,
           // Add more capabilities...
        )
    );
    if ( null !== $result ) {
        echo 'Yay! New role created!';
    }
    else {
        echo 'Oh... the editor_of_users role already exists.';
    }

For more information you can read the documentation about: add_role 有关更多信息,您可以阅读有关以下内容的文档: add_role

And the all users capabilities here: Roles and Capabilities 以及此处的所有用户功能: 角色和功能

EDIT: 编辑:

Read this post: to know how add to users the capabilities to edit specific roles... How to allow an user role to create a new user under a role which lower than his level only? 阅读这篇文章:了解如何向用户添加编辑特定角色的功能... 如何允许用户角色在仅低于其级别的角色下创建新用户?

I hope you resolve it... Good Look! 希望您能解决...好看! ;) ;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM