Make WordPress Core

Ticket #5344: selective_comment_viewing_ban.patch

File selective_comment_viewing_ban.patch, 761 bytes (added by simonwheatley, 19 years ago)

Patch altering the comment selection SQL on edit.php to not return comments if user cannot moderate comments

  • wordpress

    diff -urN wordpress.original/wp-admin/edit.php.original wordpress/wp-admin/edit.php > selective_comment_viewing_ban.patch
    old new  
    173173
    174174if ( 1 == count($posts) ) {
    175175
     176        // If the current user cannot moderate comments, don't include unmoderated comments
     177        $additional_where = '';
     178        if ( ! current_user_can('moderate_comments') ) {
     179                $additional_where = "AND comment_status <> 'unapproved'";
     180        }
    176181        $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
    177182        if ($comments) {
    178183                update_comment_cache($comments);