Make WordPress Core

Opened 21 years ago

Closed 21 years ago

Last modified 20 years ago

#1783 closed defect (bug) (fixed)

Use GMT when retrieving comments for the RSS feed

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

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
21 years ago

  • Milestone 1.5.2 → 1.6
  • Version 1.5.2 → 1.6

#2 @morydd
21 years ago

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

#3 @matt
21 years ago

  • Resolution → fixed
  • Status new → closed

(In [3076]) Fixes #1783

#4 @(none)
20 years ago

  • Milestone 2.0

Milestone 2.0 deleted

Note: See TracTickets for help on using tickets.