Welcome to Events 2.0! This is a HUGE upgrade from 1.6.5. Please make sure you have backed up before proceeding any further.

Welcome To Events 2 0 This Is A Huge Upgrade From 1 6 5 Please Make Sure You Have Backed Up Before Proceeding Any Further 1
If you are getting this error when using “The Events Calendar” it’s because on some servers Tribe’s query for checking legacy events has a flaw. This is the message:

> Welcome to Events 2.0! This is a HUGE upgrade from 1.6.5. Please make sure you have backed up before proceeding any further. You can easily revert to an old version if you want to backup first. This upgrade includes two major steps, migrating data & updating your templates as necessary. There have been significant changes to the template tags and functions. Check out our walkthrough on the upgrade before proceeding and check out the FAQ & Knowledge base from the support page. If you’re new to The Events Calendar, you may want to review our new user primer.

> You have events that need to be migrated. Please visit the bottom of the settings page to perform the migration.

(I’d also like to point out that the link to the settings page needs to be updated because it is broken, but you can access the settings page via `Settings->The Events Calendar` in the admin menu.

Anyhow, this is the code that the plugin uses to check for legacy events, it includes two functions:

private static function getLegacyEvents( $number = -1 ) {
// TODO: needs to account for either v1 posts or v2 ‘sp_events’
$query = new WP_Query( array(
‘post_status’ => ‘published’,
‘posts_per_page’ => $number,
‘meta_key’ => ‘_EventStartDate’,
‘category_name’ => ‘xEvents’
));

if (count($query->posts)) {
TribeEvents::debug( __( ‘Install has 1 or more legacy event!’, ‘tribe-events-calendar’ ), false, ‘warning’ );
}
return $query->posts;
}

And the second function:

public static function hasLegacyEvents() {
return count( self::getLegacyEvents( 1 ) );
}

The problem is that on some machines the query object that is returned looks like this:

[posts] => Array
(
[0] => Array
(
[ID] => 0
[filter] => raw
)

You can fix this by editing this file:

/wp-content/plugins/the-events-calendar/lib/tribe-the-events-calendar-import.class.php

And changing the second function to check for the empty post (around line 144):

/**
* Test for legacy events
*
* @return boolean for legacy events
*/
public static function hasLegacyEvents() {
$test = self::getLegacyEvents( 1 );
if(count($test) < 1 || empty($test[0]['ID'])) { return false; } return count($test); } I've contacted Tribe, but please let them know they need to update their plugin - it's a lot of trouble to maintain plugin fixes if they aren't incorporated in upgrades.

Related Posts:

  • No Related Posts
This entry was posted in Web Development and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *