Home › Forums › Calendar Products › Events Calendar PRO › Weekly Recurrence & Event by ID
- This topic has 5 replies, 4 voices, and was last updated 9 years, 9 months ago by
Guillaume.
-
AuthorPosts
-
July 5, 2016 at 6:13 am #1135409
Guillaume
ParticipantHi,
Thanks again for the previous support, your advices worked well.
We have another question actually: How can we add a weekly reccurence to an event by id ? We have an API and we want to make a call to add specific reccurence (daily/weekly) to an event by its ID.
How can we handle it ?For example:
array_push($my_array, array(‘type’ => $reccurence,’end-type’ =>’On’, ‘end’ =>$until));
$myRecurrence = array(‘EventStartDate’ =>$begin,
‘EventEndDate’ => $end,
‘recurrence’ => array(
‘rules’=> $my_array
));
Tribe__Events__Pro__Recurrence__Meta::updateRecurrenceMeta($postId, $myRecurrence);Thanks for your answer,
Best,
Guillaume
July 5, 2016 at 10:42 pm #1135856Geoff B.
MemberGood evening Guillaume and welcome back!
Thank you for reaching out to us and for your great words.
I would love to help you with this topic.
How can we add a weekly reccurence to an event by id ? We have an API and we want to make a call to add specific reccurence (daily/weekly) to an event by its ID. How can we handle it ?
Just to set expectations, the scope of our support is mostly to get our customers started on the right track and to help them in case of issues.
We unfortunately do not provide complete support for customization.With that in mind, the best way to get started is to look at what is going on at the user interface AND database levels when you create a recurring event.
You will notice that:
- Recurring Events are actually separate posts in the database (each with it’s own wp_postmeta)
- When an event is a recurring one, it has an additional row in wp_postmeta with the following format
_EventRecurrencea:3:{s:5:”rules”;a:1:{i:0;a:6:{s:4:”type”;s:10:”Every Week”;s:8:”end-type”;s:2:”On”;s:3:”end”;s:10:”2016-07-27″;s:9:”end-count”;s:0:””;s:14:”EventStartDate”;s:19:”2016-07-06 08:00:00″;s:12:”EventEndDate”;s:19:”2016-07-06 17:00:00″;}}s:10:”exclusions”;a:0:{}s:11:”description”;N;}
In other words, simply appending data to an existing event will probably not be enough. You need to find a way to actually create the recurring events AND add the _EventRecurrence Meta with the proper content and format.
Let me know if that helps.
Have a great day!
Geoff B.
July 11, 2016 at 1:20 am #1138027Guillaume
ParticipantHi Geoff, thanks for your really helpful answer!
We have successfully created the initial post recurring event with postmeta fulfilled (:D), but what if we want to “automatically” create recurring children event posts? Do we have to create a loop and create these event one by one with tribe_create_event for example?
thanks again for your answer,
Best,
Guillaume
July 11, 2016 at 2:14 pm #1138385Geoff B.
MemberGood evening Guillaume,
Thank you for writing back.
I’m super stoked that my initial answer was helpful to you.
We have successfully created the initial post recurring event with postmeta fulfilled (:D), but what if we want to “automatically” create recurring children event posts? Do we have to create a loop and create these event one by one with tribe_create_event for example?
Yes absolutely, this would be your best approach (using the variables found in wp_postmeta) entry.
By the way, in case you have not bumped into it already, the following function is pretty handy too: https://theeventscalendar.com/function/tribe_update_event/
Let me know how that goes.
Best regards,
Geoff B.August 2, 2016 at 9:35 am #1146641Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
AuthorPosts
- The topic ‘Weekly Recurrence & Event by ID’ is closed to new replies.
