Home › Forums › Calendar Products › Events Calendar PRO › Triggering Recurrence for Events imported via WordPress XML (WPXML)
- This topic has 7 replies, 2 voices, and was last updated 11 years, 5 months ago by
Barry.
-
AuthorPosts
-
November 10, 2014 at 7:25 am #873777
Robert
ParticipantI have searched the forums for similar issues but couldn’t find one. We are building a custom WPXML export from our proprietary event system to be able to import events to Event Calendar PRO. We are automating the process fully with wp-cli because new events are being added during development. We have reverse-engineered the repeating events aspect correctly, however notice that on import thee events are not being “converted” to repeating events (i.e. the events for each repeat instance aren’t being created and grouped correctly). However, after import if we open one of these repeating events and manually click “Update”, all the correct recurrence logic gets triggered. Is there an automated way to trigger the recurrence logic instead? I’m guessing this is a hook on save_post that is doing this, and which gets bypassed by the WPXML import. Any pointers?
November 10, 2014 at 7:28 am #873784Robert
ParticipantTo be clear, we are using the _EventRecurrence meta-data in WPXML, and this is correctly populating the fields for the Event as viewed in the WP Admin. It is not until we manually click “Update” on the event in the admin, however, that the magic happens with recurrence. We need to automate that magic.
November 10, 2014 at 4:54 pm #875000Barry
MemberHi there msia,
Sounds like an interesting piece of work 🙂
To be clear, we are using the _EventRecurrence meta-data in WPXML, and this is correctly populating the fields for the Event as viewed in the WP Admin.
In the case of the child posts are you also pulling in the _EventNextPendingRecurrence meta field and can you confirm that they are correctly being established as child posts?
Generally speaking, the first event is the parent and all subsequent instances are child posts – but if that isn’t being respected it probably takes an update to trigger their regeneration in that configuration.
November 13, 2014 at 2:38 am #881651Robert
ParticipantHi Barry,
Thanks for your reply. We’ll try implementing the _EventNextPendingRecurrence meta-data as well and see if that lets Event Calendar PRO generate all the recurrences at time of import.If that doesn’t work, is there any way to trigger an update to the post programmatically after import? (i.e. without having to manually go into each Event in the admin).
Best,
RobertNovember 13, 2014 at 8:28 am #882319Robert
ParticipantHi Barry,
So I had a look at the _EventNextPendingRecurrence meta-data and the idea of creating all child posts ourselves. Seems like a ton of work! Especially if there is some way that we can trigger the equivalent of clicking “Update” in the web-based WordPress admin programatically, so that all of these recurrences get created by the plugin instead of our export script. Do you know how we might do that?
Best,
RobertNovember 13, 2014 at 9:22 am #882492Barry
MemberHi Robert 🙂
I’d actually envision that if the data is correctly laid out in the database there’d be no reason to programmatically trigger anything. Reading your replies, I’m not sure if everything is indeed set up correctly (in terms of one parent post/many child posts, per chain of events)?
I’d love to help further on this one, but it is pretty much custom development territory and so is something that you’ll largely have to drive forward yourself, I’m afraid.
Thanks!
November 13, 2014 at 9:29 am #882531Robert
ParticipantHi Barry,
I can understand your reticence to comment on custom development. 🙂
Here’s the part that interests me most: when we do an import using the WPXML we generate, then manually open a recurring Event, all of the address fields are correctly filled out. Then, if we click “Update”, it correctly generates all of the event children for the recurrence pattern.
So, there is a way to get the plugin to do the “heavy lifting” of generating the recurrence children for us using the data we import from WPXML–but it’s a manual way. I’m wondering if we can run something after the import to do the automated equivalent programmatically of clicking “Update” on each event for which there is recurrence, thus saving us a ton of time.
Any thoughts on how that might be possible?
Because the manual approach is setting up all the parent/child relationships for us correctly. Which is a lot easier than trying to do this in the export script (and less prone to error, since we’d be guessing at the exact logic the plugin is using!)
Thanks in advance.
Best,
RobertNovember 13, 2014 at 12:29 pm #882859Barry
MemberOK, I see what you’re saying there – I’d actually interpreted things as if your XML included the individual child events but it sounds like you are exporting only one event representing the entire chain.
What I’d encourage you to look at here is TribeEventsRecurrenceMeta::saveEvents() (found in events-calendar-pro/lib/tribe-events-recurrence-meta.class.php) which is one of the keys to this process and you might be able to initiate the process by calling that.
At this point I’m going to have to wish you luck and bow out – as before, this is very much customization/custom development territory – but I do hope you reach a working solution with this 🙂
Thanks again!
-
AuthorPosts
- The topic ‘Triggering Recurrence for Events imported via WordPress XML (WPXML)’ is closed to new replies.
