Make WordPress Core

Opened 19 years ago

Closed 19 years ago

Last modified 18 years ago

#1783 closed defect (bug) (fixed)

Use GMT when retrieving comments for the RSS feed

Reported by: keshonok's profile keshonok Owned by:
Milestone: Priority: normal
Severity: major Version: 1.6
Component: General Keywords: bg|needs-testing bg|has-patch
Focuses: Cc:

Description

There are three different date/time sets. One is the UTC/GMT time. The other is the Blog time as set in the Administration Panel. That is the time zone the blogger lives in. The third is the hosting server time zone.

When the blogger posts a new entry, it is marked by the Blog Time, as well as the GMT time. However, it appears then when the comments are retrieved for the post or the posts, the post/posts are looked up by the hosting server's time comparing it against the Blog Time stored for the posts. That leads to, for instance, for the comments not appearing in the RSS feed until the hosting server's time reaches the Blog Time.

The fix is to use GMT time for the current time and GMT time stored in the database for the posts. Please see the diff below against WP 1.5.2 version of wp-commentsrss2.php:

$ diff wp/wp-commentsrss2.php.saved wp/wp-commentsrss2.php
37,38c37,38
<                       AND post_date < '".date("Y-m-d H:i:59")."'
<                       ORDER BY comment_date DESC LIMIT " . get_settings('posts_per_rss') );
---
>                       AND post_date_gmt < '".gmdate("Y-m-d H:i:59")."'
>                       ORDER BY comment_date_gmt DESC LIMIT " . get_settings('posts_per_rss') );
44,45c44,45
<                       AND $wpdb->comments.comment_approved = '1' AND post_date < '".date("Y-m-d H:i:s")."'
<                       ORDER BY comment_date DESC LIMIT " . get_settings('posts_per_rss') );
---
>                       AND $wpdb->comments.comment_approved = '1' AND post_date_gmt < '".gmdate("Y-m-d H:i:s")."'
>                       ORDER BY comment_date_gmt DESC LIMIT " . get_settings('posts_per_rss') );

Change History (4)

#1 @bryan
19 years ago

  • Milestone changed from 1.5.2 to 1.6
  • Version changed from 1.5.2 to 1.6

#2 @morydd
19 years ago

  • Keywords bg|needs-testing bg|has-patch added

#3 @matt
19 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [3076]) Fixes #1783

#4 @(none)
18 years ago

  • Milestone 2.0 deleted

Milestone 2.0 deleted

Note: See TracTickets for help on using tickets.