【问题标题】:Wordpress user role, that can only edit users with another user role?Wordpress 用户角色,只能编辑具有另一个用户角色的用户?
【发布时间】:2017-07-20 01:14:02
【问题描述】:

我创建了一个新用户角色,但我需要这个用户角色只能编辑具有另一个用户角色的用户,我不希望这个新用户角色能够编辑用户,如编辑、作者等。 ..

想法?

【问题讨论】:

    标签: wordpress


    【解决方案1】:

    您可以这样添加角色:

       $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.';
        }
    

    有关更多信息,您可以阅读以下文档:add_role

    这里的所有用户功能:Roles and Capabilities

    编辑:

    阅读这篇文章:了解如何为用户添加编辑特定角色的功能... How to allow an user role to create a new user under a role which lower than his level only?

    我希望你能解决它...好看! ;)

    【讨论】:

    • 我已经创建了角色,我需要限制角色以便只能编辑具有“订阅者”角色的用户
    • @Brooke 我已经编辑了我的答案,我已经添加了一个链接,您可以指导您解决您的问题...好看! ;) 我希望我对您有所帮助...
    猜你喜欢
    • 2014-09-05
    • 1970-01-01
    • 2018-01-12
    • 1970-01-01
    • 2012-02-24
    • 2012-10-09
    • 1970-01-01
    • 2022-10-25
    • 2021-07-27
    相关资源
    最近更新 更多