WordPress.org

Make WordPress Core

Ticket #18340: 18340.noEdit.2.diff

File 18340.noEdit.2.diff, 2.2 KB (added by DH-Shredder, 2 years ago)

Remove nested if & add check for editcomment/spam in wp-admin/comment.php

  • wp-admin/includes/class-wp-comments-list-table.php

     
    411411                                $actions['trash'] = "<a href='$trash_url' class='delete:the-comment-list:comment-$comment->comment_ID::trash=1 delete vim-d vim-destructive' title='" . esc_attr__( 'Move this comment to the trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>'; 
    412412                        } 
    413413 
    414                         if ( 'trash' != $the_comment_status ) { 
     414                        if ( 'spam' != $the_comment_status && 'trash' != $the_comment_status ) { 
    415415                                $actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' title='" . esc_attr__( 'Edit comment' ) . "'>". __( 'Edit' ) . '</a>'; 
    416416                                $actions['quickedit'] = '<a onclick="commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\',\'edit\' );return false;" class="vim-q" title="'.esc_attr__( 'Quick Edit' ).'" href="#">' . __( 'Quick&nbsp;Edit' ) . '</a>'; 
    417                                 if ( 'spam' != $the_comment_status ) 
    418                                         $actions['reply'] = '<a onclick="commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\' );return false;" class="vim-r" title="'.esc_attr__( 'Reply to this comment' ).'" href="#">' . __( 'Reply' ) . '</a>'; 
     417                                $actions['reply'] = '<a onclick="commentReply.open( \''.$comment->comment_ID.'\',\''.$post->ID.'\' );return false;" class="vim-r" title="'.esc_attr__( 'Reply to this comment' ).'" href="#">' . __( 'Reply' ) . '</a>'; 
    419418                        } 
    420419 
    421420                        $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); 
  • wp-admin/comment.php

     
    6969        if ( 'trash' == $comment->comment_approved ) 
    7070                comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') ); 
    7171 
     72        if ( 'spam' == $comment->comment_approved ) 
     73                comment_footer_die( __('This comment is marked as Spam. Please mark it as Not Spam if you want to edit it.') ); 
     74 
    7275        $comment = get_comment_to_edit( $comment_id ); 
    7376 
    7477        include('./edit-form-comment.php');