Ticket #14222: 14222.patch
| File 14222.patch, 1.4 KB (added by Viper007Bond, 3 years ago) |
|---|
-
wp-admin/includes/dashboard.php
523 523 global $wpdb; 524 524 525 525 if ( current_user_can('edit_posts') ) 526 $allowed_states = array('0', '1');526 $allowed_states = 'AND c.comment_approved IN (0,1)'; 527 527 else 528 $allowed_states = array('1');528 $allowed_states = 'AND c.comment_approved = 1'; 529 529 530 530 // Select all comment types and filter out spam later for better query performance. 531 531 $comments = array(); … … 537 537 else 538 538 $total_items = 5; 539 539 540 while ( count( $comments ) < 5 && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT $start, 50" ) ) {540 while ( count( $comments ) < 5 && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE p.post_status != 'trash' $allowed_states ORDER BY c.comment_date_gmt DESC LIMIT $start, 50" ) ) { 541 541 542 542 foreach ( $possible as $comment ) { 543 543 if ( count( $comments ) >= $total_items ) 544 544 break; 545 if ( in_array( $comment->comment_approved, $allowed_states ) &¤t_user_can( 'read_post', $comment->comment_post_ID ) )545 if ( current_user_can( 'read_post', $comment->comment_post_ID ) ) 546 546 $comments[] = $comment; 547 547 } 548 548
