Home › Forums › Calendar Products › Event Aggregator › Can't re-import same events from ical feed after importing and deleting them
- This topic has 8 replies, 2 voices, and was last updated 8 years, 3 months ago by Nico.
-
AuthorPosts
-
December 13, 2015 at 9:37 am #1040532NienkeParticipant
Hi,
After upgrading the ical plugin to 4.01 I was doing the following:
1. I imported an ‘the events calendar’ ical feed ‘x’ from site#1 in site#2 (lets say 10 events in 2016)
2. For some reason I deleted the just imported 10 events in site#2
3. I tried to re-import the same ical feed ‘x’ from site#1 in site#2 but now it shows no items at all.. (the feed contains 10 events..)I think it has something to do with the ‘duplicate events’ bug in v4… That it is trying not to duplicate the events??
I have two questions:
How can I reimport the same ical feed (after deleting the just imported events)?
will reimporting the same feed (but with in the meantime changed events…like changed descriptions) results in the ical updater updating the already imported events?Thanks in advance….
Nienke
December 14, 2015 at 8:46 pm #1041282NicoMemberHowdy Nienke,
Welcome to our support forums and thanks for reaching out to us. I’ll help you out with this issue!
What you describe is the default behaviour of the plugin: once you import an event via iCal importer and then delete it the system stores a “note” so that deleted events are not re-imported (as this would be the desired behavior for most cases and for automatic imports as well).
To delete saved “deleted events notes”
Add this snippet to your theme functions.php file and re-load the page (it will run once per page-load) until the message is shown, after that remove or comment the script:
/* Deletes 50 posts per page load*/
$posts = get_posts( array( 'numberposts' => 50, 'post_type' =>'deleted_event') );
if (!empty($posts)) {
foreach ($posts as $post) {
wp_delete_post( $post->ID, true);
}
} else {
echo 'Done deleting!';
}
To prevent “deleted events notes” from being created in the future
Add this other snippet to modify this default behaviour:
/*
* Prevents iCal importer from saving a copy of "deleted" events
*/
function tribe_ical_dont_save_deleted () {
$ical_importer = Tribe__Events__Ical_Importer__Main::instance();
remove_action( 'before_delete_post', array( $ical_importer, 'deletedEventSave' ) );
}
add_action( 'wp_loaded', 'tribe_ical_dont_save_deleted' );
will reimporting the same feed (but with in the meantime changed events…like changed descriptions) results in the ical updater updating the already imported events?
The events should be updated yes, give that a try and let me know.
Please let me know if you get the events to show again after using the snippets,
Best,
NicoDecember 15, 2015 at 8:06 am #1041719NienkeParticipantHi Nico,
Thanks for your quick response. But no I tried it and the functions run succesfully but won’t resolve the issue. The ical feed is not showing the 10 already imported-but-deleted events. In fact I used the number 10 as just a number. Our feed contains much more items…otherwise I would type them by hand 😉
So is there an other approach to this? Can I do something by hand in the MySql database?
Please advise.
Thanks in advance.
Nienke
December 16, 2015 at 6:56 am #1042293NienkeParticipantThis reply is private.
December 16, 2015 at 8:12 am #1042331NicoMemberHey Nienke,
Thanks for following up on this! Sorry to hear this didn’t work.
Can I do something by hand in the MySql database?
Yes, you can delete the saved ‘notes’ using the following SQL Query (make sure to backup the db before proceeding):
DELETE FROM wp_posts WHERE post_type = 'deleted_event';
The code above assumes your table prefix is ‘wp_’ if you changed that when installing WordPress, you’ll need to adjust the table name accordingly.Please let me know if that helps,
Best,
NicoDecember 17, 2015 at 6:04 am #1042694NienkeParticipantThis reply is private.
December 18, 2015 at 11:06 am #1043722NicoMemberThis reply is private.
December 27, 2015 at 2:46 am #1046949NienkeParticipantSorry for my late reply (we were extremely busy 😉 but everything went well in the end…. We postponed to the mondat after christmas (tomorrow). We also upgraded all plugins on both sites to the latest.
After doing the whole procedure over (including clearing MySQL) and set the correct timezone (Amsterdam) & dateformats the import succeeded.
Our final conclusion: the timezone and formats (in the ical) where indeed different. The one was set to “UTC+1” and the other was set to “Amsterdam”.
Thanks Nico and have a wonderful 2016!
Nienke
December 28, 2015 at 12:55 pm #1047532NicoMemberGlad to hear Nienke 🙂
I’ll go ahead and close out this thread, but if you need help with anything else please don’t hesitate to create a new one and we will be happy to assist you.
Best wishes for 2016 to you too, thanks 🙂
Nico -
AuthorPosts
- The topic ‘Can't re-import same events from ical feed after importing and deleting them’ is closed to new replies.