Support » Alpha/Beta/RC » Edit Comment not working

  • Resolved wildkyo


    Hi guys!

    I’ve tried to get working the Edit Comment Capability with WordPress 3.1 Beta 1 but I can’t. As I understand Contributors now can Edit Comments so if you put the edit_comment_link() function then Contributors must see the link to edit his comments. But it doesn’t!

    Anyway I tried to add the capability manually but I’ve the same result.

    if (current_user_can(‘contributor’)
    add_action(‘admin_init’, ‘allow_contributor_comments’);

    function allow_contributor_comments() {
    $contributor = get_role(‘contributor’);

    So, is this option available? Anyone can please give me a hand on this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Andrew Nacin


    Lead Developer

    This simply won’t work.

    edit_comment is a meta capability. It gets re-mapped to another meta capability, edit_post (which may change depending on the post type), which is then mapped to the primitive capabilities (what users and roles have).

    For a contributor to moderate any comment means that you need to let them edit all posts.

    Or, you can just drop a filter on map_meta_cap() to do this. (No role modifications needed, except to also give them the moderate_comments cap.)

    It would look something like this (wholly untested):

    function nacin_contributors_can_moderate_comments( $caps, $cap ) {
       if ( $cap == 'edit_comment' )
         $caps = array( 'edit_posts' );
       return $caps;
    add_filter( 'map_meta_cap', 'nacin_contributors_can_moderate_comments', 10, 2 );

    Oh hell… I misunderstood it. Thanks for the explanation! I thought that this new capability allow users to edit their own comments but I see that I was wrong. I don’t understand why WordPress doesn’t have yet this capability like “edit_own_comments” or something similar.

    Thank you very much for your reply and explanation!

    Moderator Andrew Nacin


    Lead Developer

    Ultimately, we can’t change the way core currently works, such that authors can moderate comments on their own posts. But we can make it easier for plugins to modify it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Edit Comment not working’ is closed to new replies.