Ticket #1783 (closed defect: fixed)

Opened 3 years ago

Last modified 2 years ago

Use GMT when retrieving comments for the RSS feed

Reported by: keshonok Assigned to: anonymous
Priority: normal Milestone:
Component: General Version: 1.6
Severity: major Keywords: bg|needs-testing bg|has-patch
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

10/23/05 21:09:41 changed by bryan

  • version changed from 1.5.2 to 1.6.
  • milestone changed from 1.5.2 to 1.6.

11/07/05 14:26:36 changed by morydd

  • keywords set to bg|needs-testing bg|has-patch.

11/14/05 10:04:26 changed by matt

  • status changed from new to closed.
  • resolution set to fixed.

(In [3076]) Fixes #1783

11/30/06 19:41:47 changed by

  • milestone deleted.

Milestone 2.0 deleted