admin管理员组

文章数量:1122846

I want to setup a user account that only has access to moderate comments - for all posts - but doesn't have access to edit any posts.

When I give the user the moderate comments privilege (using an old role manager plugin), it doesn't let them moderate comments on other articles.

Is there a plugin that does this, or something I'm doing wrong?

I want to setup a user account that only has access to moderate comments - for all posts - but doesn't have access to edit any posts.

When I give the user the moderate comments privilege (using an old role manager plugin), it doesn't let them moderate comments on other articles.

Is there a plugin that does this, or something I'm doing wrong?

Share Improve this question asked Apr 14, 2011 at 23:03 The How-To GeekThe How-To Geek 2451 gold badge3 silver badges10 bronze badges
Add a comment  | 

2 Answers 2

Reset to default 2

Probably not the answer you want to hear, but I'm afraid that is not possible as a user needs the edit_posts Capability in order to access the moderate_comments capability.

(source: http://codex.wordpress.org/Roles_and_Capabilities#moderate_comments)

Took a crazy amount of trial and error but these are the capabilities I found I needed to add for a moderator role:

    // add the new role
    add_role('moderator', 'Moderator', get_role('subscriber')->capabilities);
    // gets the moderator role
    $role = get_role('moderator');
    // add capabilities
    // moderate_comments requires edit_posts - Heaven's knows why...
    $role->add_cap('edit_posts');
    $role->add_cap('moderate_comments');
    // and you need to edit_others_posts otherwise you can only moderate comments on your own posts... this seems a tiny but outdated...
    $role->add_cap('edit_others_posts');
    // and you need to be able to edit_published_posts - so moderate_comments REALLY doesn't do what you think...
    $role->add_cap('edit_published_posts');

本文标签: How Do I Allow Comment Moderation for Other User39s Posts