1

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?

2 Answers 2

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)

3
  • I can give the user edit_posts as well, but they still can't edit comments from other users. It seems that you can only do it with edit_others_posts. Commented Apr 15, 2011 at 1:38
  • I went through the code, and it appears there's no hook to fix this, at least not without a lot of hacking. Commented Apr 15, 2011 at 1:50
  • You can use the load-edit-comments.php and load-comment.phpaction hook to callback a function that will add the edit_others_posts capabilities to the current user so it will allow the edit-comments.php and comment.php to load correctly , and then remove this at capability form the current user at admin_footer action hook so this capability is only valid for comment moderation screens.
    – Bainternet
    Commented Apr 15, 2011 at 2:18
0

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');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.