Can't re-import same events from ical feed after importing and deleting them

Home Forums Calendar Products Event Aggregator Can't re-import same events from ical feed after importing and deleting them

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1040532
    Nienke
    Participant

    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

    #1041282
    Nico
    Member

    Howdy 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,
    Nico

    #1041719
    Nienke
    Participant

    Hi 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

    #1042293
    Nienke
    Participant

    This reply is private.

    #1042331
    Nico
    Member

    Hey 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,
    Nico

    #1042694
    Nienke
    Participant

    This reply is private.

    #1043722
    Nico
    Member

    This reply is private.

    #1046949
    Nienke
    Participant

    Sorry 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

    #1047532
    Nico
    Member

    Glad 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

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Can't re-import same events from ical feed after importing and deleting them’ is closed to new replies.