Home › Forums › Calendar Products › Events Calendar PRO › Issues with publish date on RSS Feed
- This topic has 8 replies, 2 voices, and was last updated 11 years, 2 months ago by
Brook.
-
AuthorPosts
-
January 13, 2015 at 9:12 pm #932438
cfcpca
ParticipantGood evening,
I’m aware of some issues others are having with the published date showing incorrectly on RSS feeds, and unfortunately I’m having the same issue. I’ve seen the following threads already:
I tried implementing the fix suggested in the third linked thread (using -7 for the offset instead of -2 as was posted), and found that the date would then be 49 hours off instead of just 7. Furthermore after some additional testing I found that I was finding three different times depending on what I used to view the feed.
http://cfcpca.org/events/category/featured/feed/
Viewing the above link in chrome shows the raw feed data and I see the correct date/time. Viewing it in Firefox shows the time 7 hours behind what Chrome does and viewing it with an online feed reader from SimplePie shows it 8 hours behind what Chrome does, and therefore 1 hour behind what Firefox is showing.
Any assistance would be greatly appreciated in fixing the feed issues we’re having here. Thanks!
January 14, 2015 at 11:22 pm #933099Brook
ParticipantHowdy cfcpa,
I would be happy to help you with that. What Chrome is showing is the raw data. It is saying that the “MOPS” event will take place at 9am UTC. It sounds like you are in the mountain time zone though, so Firefox is show the time for UTC -7.
What are your timezone settings like in WP Admin > Settings > General. There should be a drop down called timezone, and it applies to the timezone for your entire WP site. What is that set to?
Please let me know if you have any questions of your own. Thanks!
– Brook
January 15, 2015 at 9:00 am #933327cfcpca
ParticipantThe time zone is currently set to Phoenix.
January 16, 2015 at 8:07 pm #933925Brook
ParticipantThanks cfcpa. Upon further experimentation I have been able to reproduce this issue as a bug in our plugin. I am going to get this logged so the developers can fix it.
In the mean time you could fix this by attaching a function to ‘get_post_time’ that behaves like our function ‘event_date_to_pubDate’:
[php]function event_date_to_pubDate( $time, $d, $gmt ) {
global $post;if ( isset($post) && $post->post_type == TribeEvents::POSTTYPE && is_feed() && $gmt ) {
$time = tribe_get_start_date( $post->ID, false, $d );
$time = mysql2date( $d, $time );
}return $time;
}[/php]Only set the variable $gmt to your local timezone by default.
I am sorry that you are experiencing a bug. Let me know if you have any questions. Thanks!
– Brook
January 16, 2015 at 8:07 pm #933926Brook
Participant[comment deleted]
January 19, 2015 at 8:47 am #934719cfcpca
ParticipantBrook,
Thanks for looking into it. So you’re saying I just need to add a filter to get_post_time that uses the function you linked? Like so:
add_filter( 'get_post_time', 'cfc_event_date_to_pubDate', 20 , 3 ); function cfc_event_date_to_pubDate( $time, $d, $gmt ) { global $post; if ( isset($post) && $post->post_type == TribeEvents::POSTTYPE && is_feed() && $gmt ) { $time = tribe_get_start_date( $post->ID, false, $d ); $time = mysql2date( $d, $time ); } return $time; }January 19, 2015 at 2:52 pm #934889Brook
ParticipantHello Cfc,
That is basically exactly what I mean. However, upon further inspection I realized that more is required. You would actually have to convert the date value’s timezone before passing it mysql2date(), which expects the timezone to be GMT. That is the crux of the issue.
This will require a little more development. I might be able to write something up tomorrow, but it’s also possible that in the end we will have to wait for this bug to be patched in the plugin. I will let you know tomorrow.
Cheers!
January 21, 2015 at 1:15 am #935546Brook
ParticipantHowdy again cfc,
This snippet should do the trick. Just make sure the offset is correct. You can add or subtract hours with it.
[php]
add_filter( ‘get_post_time’, ‘events_rss2_gmt_pubdate_correction’, 20 , 3 );function events_rss2_gmt_pubdate_correction($time, $d, $gmt) {
global $post;
// Amount of hours to change, equals GMT offset
$offset = -7;if ( $post->post_type === TribeEvents::POSTTYPE && is_feed() ) {
$time = new DateTime( tribe_get_start_date( $post->ID, false, $d ) );
$time->modify( $offset.’ hour’ );
$time = $time->format( TribeDateUtils::DBDATETIMEFORMAT );
$time = mysql2date( $d, $time );}
return $time;
}
[/php]Did that work? I appreciate your patience through this. Let me know if that helps, or if I can assist in some other way. Cheers!
– Brook
February 2, 2015 at 11:24 pm #939638Brook
ParticipantSince this topic has gone for a couple weeks without a response I am going to archive it. If you need anything else though, or even need to continue this at a future date, please feel free to open a new topic. We will be happy to help. Cheers!
– Brook
-
AuthorPosts
- The topic ‘Issues with publish date on RSS Feed’ is closed to new replies.
