From db7e77a251f244e434ebd0edd979b042d029c409 Mon Sep 17 00:00:00 2001 From: ryan Date: Fri, 6 Mar 2009 08:16:35 +0000 Subject: [PATCH] Order by comment_date_gmt git-svn-id: http://svn.automattic.com/wordpress/trunk@10732 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment-template.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wp-includes/comment-template.php b/wp-includes/comment-template.php index 8dd612edc..5e626a483 100644 --- a/wp-includes/comment-template.php +++ b/wp-includes/comment-template.php @@ -814,11 +814,11 @@ function comments_template( $file = '/comments.php', $separate_comments = false /** @todo Use API instead of SELECTs. */ if ( $user_ID) { - $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND (comment_approved = '1' OR ( user_id = %d AND comment_approved = '0' ) ) ORDER BY comment_date", $post->ID, $user_ID)); + $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND (comment_approved = '1' OR ( user_id = %d AND comment_approved = '0' ) ) ORDER BY comment_date_gmt", $post->ID, $user_ID)); } else if ( empty($comment_author) ) { - $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1' ORDER BY comment_date", $post->ID)); + $comments = get_comments( array('post_id' => $post->ID, 'status' => 'approve', 'order' => 'ASC') ); } else { - $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND ( comment_approved = '1' OR ( comment_author = %s AND comment_author_email = %s AND comment_approved = '0' ) ) ORDER BY comment_date", $post->ID, $comment_author, $comment_author_email)); + $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND ( comment_approved = '1' OR ( comment_author = %s AND comment_author_email = %s AND comment_approved = '0' ) ) ORDER BY comment_date_gmt", $post->ID, $comment_author, $comment_author_email)); } // keep $comments for legacy's sake