Past Events not being displayed
I just upgraded to 3.0 and now “show previous events” link displays no events. xxx/events/past is the link it’s using. Did I wipe out some page templates or something when I upgraded?
Thanks in advance.
Hey GolfDawgg – thanks for posting this, and for updating early. I apologize on behalf of the whole team for the inconvenience you’ve faced here.
Does this occur even after you resave (flush) permalinks? The “past” events template isn’t something that should have been changed much on this end, so I wonder if it’s not a permalinks- or cache- related issue. if you can try clearing both and let me know whether the issue persists (with a link to the site-in-question, if possible) it’d be helpful. We can do our best to try and get it sorted for you from there.
I can confirm this bug. I have the same issue with my page. I have flushed permalinks and the problem persists.
My site is currently password protected so I can’t send you a link.
I’m seeing this as well after a permalink flush.
Live site: http://www.lawsocietygazette.ca/events/
No upcoming events exist but until I upgraded there were about 40 recent events.
Same issue since upgrade, also event name link in widget goes to what ever page you are currently on
site at http://competitioncarving.com
I should say that my link above no longer reflects the problem because I rolled back to 2.011
Here’s an example of the issue. Vanilla wordpress, default theme, no other plugins.
Yep, got the same problem.
Yes me too, same problem with past events link showing no events even though I do see the events in the backend. I didn’t upgrade from a previous version though, I installed this for the first time on a new website (I have used the old events calendar on other websites no problem).
The events are present in my backend as well, this definitely seems to be an issue with the previous events display page.
Okay, so I think I’ve found the issue. The query for past events is a mess.
$wp_the_query currently shows
SELECT SQL_CALC_FOUND_ROWS DISTINCT wp_posts.*, wp_postmeta.meta_value as EventStartDate, tribe_event_duration.meta_value as EventDuration, DATE_ADD(CAST(wp_postmeta.meta_value AS DATETIME), INTERVAL tribe_event_duration.meta_value SECOND) as EventEndDate FROM wp_posts LEFT JOIN wp_postmeta as tribe_event_duration ON ( wp_posts.ID = tribe_event_duration.post_id AND tribe_event_duration.meta_key = '_EventDuration' ) WHERE 1=1 AND wp_posts.post_type = 'tribe_events' AND (wp_posts.post_status = 'publish') AND DATE_ADD(CAST(wp_postmeta.meta_value AS DATETIME), INTERVAL tribe_event_duration.meta_value SECOND) < '2013-07-09 13:31:22' ORDER BY wp_posts.post_date DESC LIMIT 0, 5
There is no postmeta row with the key ‘_EventDuration’ There are only start and end date keys. The query should read:
SELECT SQL_CALC_FOUND_ROWS DISTINCT wp_posts.*, tribe_event_start.meta_value as EventStartDate, tribe_event_end.meta_value as EventEndDate, TIMESTAMPDIFF(SECOND,tribe_event_start.meta_value,tribe_event_end.meta_value) as EventDuration FROM wp_posts LEFT JOIN wp_postmeta as tribe_event_start ON ( wp_posts.ID = tribe_event_start.post_id AND tribe_event_start.meta_key = '_EventStartDate' ) LEFT JOIN wp_postmeta as tribe_event_end ON ( wp_posts.ID = tribe_event_end.post_id AND tribe_event_end.meta_key = '_EventEndDate' ) WHERE 1=1 AND wp_posts.post_type = 'tribe_events' AND (wp_posts.post_status = 'publish') AN tribe_event_end.meta_value < '2013-07-09 13:31:22' ORDER BY wp_posts.post_date DESC LIMIT 0, 5
When I run this query against my db it returns the past events. Now that I know the proper query I just need to figure out where in the PHP code this query is sent.
Any help would be appreciated.
Okay, so I think I was barking up the wrong tree with modifying the query. The issue is really that there is no postmeta row with the key _EventDuration. When I create those rows manually, things work a little better. There is still an issue with the column wp_postmeta.meta_value.
wp_postmeta is used without having been joined. This query is missing a JOIN statement.
I was able to fix this by adding ‘_EventDuration’ to the
public $metaTags = array( '_EventAllDay', '_EventStartDate', '_EventEndDate', '_EventDuration', '_EventVenueID', '_EventShowMapLink', '_EventShowMap', '_EventCurrencySymbol', '_EventCost', '_EventURL', '_EventOrganizerID', '_EventPhone', '_EventHideFromUpcoming', self::EVENTSERROROPT );
And by inserting the following after line 101 of
$data['EventDuration'] = $endTimestamp - $startTimestamp;
The _EventDuration key was not being stored, as mdd061000 discovered, so I hacked this together to save it (as the duration in seconds). Would appreciate feedback from the developers—my past events page works now, at any rate.
This fixes the issue mentioned here:
But I still have an empty past events page.
The query is ending in error for me bacause wp_postmeta (the source of the startDate) is not being joined in my query.
- The topic ‘Past Events not being displayed’ is closed to new replies.