Forum Replies Created
-
AuthorPosts
-
July 18, 2018 at 7:20 pm in reply to: BUG: Event Aggregator gets wrong dates for Multi-Day events that span today #1578652randy hurstParticipant
Here’s a sample of my test calendar. It seems that regardless of what day the multi-day event is supposed to start, the aggregator shifts it to start tomorrow if the event has already begun at the time of the import. And the duration of the event remains the same, pushing out the end date to be incorrect as well.
July 16, 2018 at 8:12 am in reply to: Changed/Removed events in Google Calendar not reflected after import #1576202randy hurstParticipantThat snippet already was the inspiration for the plugin code we ended up with. This is enough to close this issue. Thanks for your help.
July 16, 2018 at 7:53 am in reply to: BUG: Event Aggregator gets wrong dates for Multi-Day events that span today #1576173randy hurstParticipantPlease review the bug description a little more carefully – especially the description of the actual results. It’s not merely missing the past days on the import; it’s getting both the start and end date completely wrong. It is using the end date as if it were the start date, yet the duration of the event remains the same, pushing the end date far into the future.
The point is, if the start of the import is after a multi-day event begins but before it ends, then the dates of the imported event are wrong. This is still a defect that needs to be fixed and cannot be worked around simply by changing the default start date of the import.
July 13, 2018 at 7:35 pm in reply to: Changed/Removed events in Google Calendar not reflected after import #1575159randy hurstParticipantThe new
tribe_aggregator_record_finalized
hook seems to do the trick for me.Here’s what I ended up with, and it seems to work great – even with every variant of recurring events and exceptions that I could throw at it…
<?php /** Created by PhpStorm. Plugin Name: Berean Baptist Church Calendar Import Fixer Description: Forces removal of events no longer represented in the imported calendar. Version: 0.0.1 Author: Steve Dwire for Berean Baptist Church Author URI: https://www.berean-baptist.org/ License: GPLv2 */ class BBC_EC_ImportFixer { const VERSION = '0.0.1'; public function __construct() { add_action( 'init', array( $this, 'init' ) ); } public function init() { add_action( 'tribe_aggregator_record_finalized', array( $this, 'handle_before_insert_posts'), 10, 2 ); } public function handle_before_insert_posts($record_id, $record_meta ) { $this_category_term_id = Tribe__Utils__Array::get( $record_meta, 'category', false ); if ( empty( $this_category_term_id ) ) { return; } $relevant_existing_events = tribe_get_events( [ 'fields' => 'ids', 'start_date' => date( 'Y-m-d H:i:s', time() ), // starting now or later 'tax_query' => [ [ 'taxonomy' => Tribe__Events__Main::TAXONOMY, 'field' => 'term_id', 'terms' => [ $this_category_term_id ], 'operator' => 'IN' ] ], 'meta_key' => '_uid', 'meta_value' => $record_meta['ids_to_import'], 'meta_compare' => 'NOT IN' ] ); foreach ( $relevant_existing_events as $event_id ) { wp_delete_post( $event_id, true ); } } } new BBC_EC_ImportFixer();
July 6, 2018 at 8:35 pm in reply to: Changed/Removed events in Google Calendar not reflected after import #1569794randy hurstParticipantThanks, AndrĂ¡s.
I’ve added some details to the User Voice request at https://tribe.uservoice.com/forums/195723-feature-ideas/suggestions/34418881-allow-event-aggregator-to-delete-events-which-have to address the developer’s comments.
July 4, 2018 at 1:03 pm in reply to: Changed/Removed events in Google Calendar not reflected after import #1567816randy hurstParticipantI have looked into the tribe_aggregator_before_insert_posts action, and that appears to be triggered once for each imported event, with $items containing only a single item. In scouring the source code for the scheduled queues in The Events Calendar, I have been unable to find a hook that provides a suitable hook to delete the imported category’s events prior to the import’s execution.
I have added a vote to this User Voice submission.
Until that User Voice issue is addressed or a suitable hook is available for us to delete the events through a custom plugin of our own, we are unable to use the events calendar for our website.
If you can let me know of a trigger I can hook into that executes only before the import and provides the category being imported, we can apply our own workaround. If not, please cancel our support subscription, as we will be uninstalling The Events Calendar from our website.
June 28, 2018 at 7:39 am in reply to: Changed/Removed events in Google Calendar not reflected after import #1563596randy hurstParticipantHere’s an example of an event that recently changed but has not been updated:
BEGIN:VEVENT DTSTART;VALUE=DATE:20180618 DTEND;VALUE=DATE:20180701 DTSTAMP:20180628T141355Z UID:[email protected] ATTENDEE;CUTYPE=INDIVIDUAL;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;CN=Church ;X-NUM-GUESTS=0:mailto:berean-baptist.org_2733lpv2r2j1v6mdamd16ptgco@group. calendar.google.com CREATED:20170816T194647Z DESCRIPTION: LAST-MODIFIED:20180611T172602Z LOCATION: SEQUENCE:0 STATUS:CONFIRMED SUMMARY:Teen Mission Trip TRANSP:TRANSPARENT END:VEVENT
After I run the import and wait for it to complete (green check mark in the History tab), a search for that Event from the admin Events page claims that the event ends on July 10 (which is incorrect, as the date in the ICS says it ends on July 1).
Actually, when I run a preview on this import, it also claims to believe that the event ends on July 10. So it may not be a failure to update; it may be a failure to properly interpret the ICS during the import.
June 28, 2018 at 7:23 am in reply to: Changed/Removed events in Google Calendar not reflected after import #1563559randy hurstParticipantIf we cannot automatically delete events from our website calendar as they are removed from the Google calendar, then our subscription to Events Calendar Pro has lost all of its value. We will need to remove the plugin and revert to embedding our Google calendar directly so that we can be sure our website calendar is accurate.
Here are two options your developers could use to ensure that events deleted from Google calendar are removed from the website:
1. Each event from the Google calendar includes a UID that uniquely represents the event from Google. Here’s an example: [email protected]. Events Calendar could store that UID with each event within WordPress. After an import is complete, any of the imported category’s existing events whose UID was not found in the most recent import could be removed.
2. An option could be added to the import definition to delete all events from the associated calendar immediately prior to the import. This is less desirable, as any problem with the import would leave the website with an empty calendar. Still, in our case, it would be preferred over leaving obsolete events displayed on our website.
I recognize that either of these approaches would not work for a website that imports multiple external calendars into a single category. But for a website like ours where each external calendar is tied to exactly one category, the ability to keep them perfectly in sync (including deletes) is absolutely essential. Please give us the option to delete events that are not found in the import.
June 27, 2018 at 8:12 am in reply to: Changed/Removed events in Google Calendar not reflected after import #1562656randy hurstParticipantOh… and – for at least the last several days – every time that line appears in the PHP error log, it can be tied to a calendar import, and there are no other messages in the PHP error log for the last ten days, though this line shows up 15 times. (We have four calendars with nightly scheduled imports.)
randy hurstParticipantThis reply is private.
-
AuthorPosts