Ticket #13939: get_page_of_comment.diff
File get_page_of_comment.diff, 1.4 KB (added by , 11 years ago) |
---|
-
wp-includes/comment.php
712 712 $args = wp_parse_args( $args, $defaults ); 713 713 714 714 if ( '' === $args['per_page'] && get_option('page_comments') ) 715 $args['per_page'] = get_ query_var('comments_per_page');715 $args['per_page'] = get_option('comments_per_page'); 716 716 if ( empty($args['per_page']) ) { 717 717 $args['per_page'] = 0; 718 718 $args['page'] = 0; … … 739 739 740 740 $comtypewhere = ( 'all' != $args['type'] && isset($allowedtypes[$args['type']]) ) ? " AND comment_type = '" . $allowedtypes[$args['type']] . "'" : ''; 741 741 742 if ( $args['max_depth'] > 1 ) 743 $fromparent = ' AND comment_parent = 0'; 744 else 745 $fromparent = ''; 746 742 747 // Count comments older than this one 743 $oldercoms = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_parent = 0AND comment_approved = '1' AND comment_date_gmt < '%s'" . $comtypewhere, $comment->comment_post_ID, $comment->comment_date_gmt ) );748 $oldercoms = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = %d" . $fromparent . " AND comment_approved = '1' AND comment_date_gmt < '%s'" . $comtypewhere, $comment->comment_post_ID, $comment->comment_date_gmt ) ); 744 749 745 750 // No older comments? Then it's page #1. 746 751 if ( 0 == $oldercoms )