From ffd54c67a6ff577cf5b00aefaac1593999a6a9ef Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 28 Jan 2009 18:43:08 +0000 Subject: [PATCH] Include only approved comments when determining page of comment. Props GregMulhauser. fixes #8973 for trunk git-svn-id: https://develop.svn.wordpress.org/trunk@10449 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/comment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 60692106b1..49a39fd989 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -592,7 +592,7 @@ function get_page_of_comment( $comment_ID, $args = array() ) { $comtypewhere = ( 'all' != $args['type'] && isset($allowedtypes[$args['type']]) ) ? " AND comment_type = '" . $allowedtypes[$args['type']] . "'" : ''; // Count comments older than this one - $oldercoms = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_parent = 0 AND comment_date_gmt < '%s'" . $comtypewhere, $comment->comment_post_ID, $comment->comment_date_gmt ) ); + $oldercoms = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_parent = 0 AND comment_approved = '1' AND comment_date_gmt < '%s'" . $comtypewhere, $comment->comment_post_ID, $comment->comment_date_gmt ) ); // No older comments? Then it's page #1. if ( 0 == $oldercoms )