Ticket #14222: 14222.2.patch
File 14222.2.patch, 1.5 KB (added by , 11 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 = 'c.comment_approved IN (0,1) AND'; 527 527 else 528 $allowed_states = array('1');528 $allowed_states = 'c.comment_approved = 1 AND' ; 529 529 530 // Select all comment types and filter out spam later for better query performance.531 530 $comments = array(); 532 531 $start = 0; 533 532 … … 537 536 else 538 537 $total_items = 5; 539 538 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 WHEREp.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT $start, 50" ) ) {539 while ( count( $comments ) < $total_items && $possible = $wpdb->get_results( "SELECT * FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_ID = p.ID WHERE $allowed_states p.post_status != 'trash' ORDER BY c.comment_date_gmt DESC LIMIT $start, 50" ) ) { 541 540 542 541 foreach ( $possible as $comment ) { 543 542 if ( count( $comments ) >= $total_items ) 544 543 break; 545 if ( in_array( $comment->comment_approved, $allowed_states ) &¤t_user_can( 'read_post', $comment->comment_post_ID ) )544 if ( current_user_can( 'read_post', $comment->comment_post_ID ) ) 546 545 $comments[] = $comment; 547 546 } 548 547