[wp-trac] [WordPress Trac] #31101: get_page_of_comment returns wrong page if comments are ordered with newest first

WordPress Trac noreply at wordpress.org
Thu Jan 22 22:04:21 UTC 2015


#31101: get_page_of_comment returns wrong page if comments are ordered with newest
first
--------------------------+-----------------------------
 Reporter:  pajtai        |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Comments      |    Version:  4.1
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 Set newest to be at top of comments.

 Now the newest comments should be on page 1, but the last page is still
 returned, becuase the sql statement counts the number of older comments
 still, since the less than sign is hard coded:


 {{{
 // The following should have the less than sign be greater than if newest
 comments are shown first:
  $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 ) );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31101>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list