Ticket #9211: widgets.diff
| File widgets.diff, 1.0 KB (added by menelicte, 4 years ago) |
|---|
-
wp-includes/widgets.php
1387 1387 $number = 1; 1388 1388 else if ( $number > 15 ) 1389 1389 $number = 15; 1390 $can_read_priv_posts=current_user_can('read_private_posts')?"OR p.post_type='post'":""; 1391 $can_read_priv_pages=current_user_can('read_private_pages')?"OR p.post_type='page'":""; 1390 1392 1391 1393 if ( !$comments = wp_cache_get( 'recent_comments', 'widget' ) ) { 1392 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BYcomment_date_gmt DESC LIMIT $number");1394 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments c LEFT JOIN $wpdb->posts p ON c.comment_post_id = p.ID WHERE c.comment_approved = '1' AND p.post_status<>'draft' AND (p.post_status<>'private' $can_read_priv_posts $can_read_priv_pages ) ORDER BY c.comment_date_gmt DESC LIMIT $number"); 1393 1395 wp_cache_add( 'recent_comments', $comments, 'widget' ); 1394 1396 } 1395 1397 ?>
