Home › Forums › Calendar Products › Event Aggregator › Hook on Facebook event created
- This topic has 4 replies, 3 voices, and was last updated 10 years, 2 months ago by
Support Droid.
-
AuthorPosts
-
January 25, 2016 at 6:17 am #1061755
Keith
ParticipantI think I read somewhere that a hook was being introduced with version 4 to allow code to be executed when a Facebook Event is created. Could you point me to the details? Thanks.
January 25, 2016 at 6:31 am #1061758George
ParticipantHey Keith,
Sure thing, there’s indeed a new hook now that fires when a Facebook Event is created inside your wp-admin site.
The hook is this: tribe_events_facebook_event_created.
It offers the following three arguments: $event_id, $organizer_id, and $venue_id.
Those variable names are very literally in their naming – the $event_id is the ID of the event inside wp-admin that was just created, and the $organizer_id and $venue_id variables are the IDs of the organizer and venue of that event, respectively.
To use this in code, you’d write something like this:
function tribe_support_example( $event_id, $organizer_id, $venue_id ) {
// Do stuff with $event_id, or $organizer_id, or $venue_id, or with all three!
}add_action( 'tribe_events_facebook_event_created', 'tribe_support_example', 10, 3 );
I hope this all helps!
Cheers,
GeorgeJanuary 25, 2016 at 6:40 am #1061770Keith
ParticipantHi George,
Thanks for that. What I’m wanting to do is add categories or possibly custom fields to the events when they are created. I’m assuming with the event_id I can access the event that has just been created and make the necessary changes.
Cheers,
KeithJanuary 25, 2016 at 8:01 am #1061823George
ParticipantSure thing Keith!
And yes, you can absolutely add categories and such in that hook, using the event_id and WordPress core functions.
We are not able to help with custom coding here, so you’ll have to take the reins on that – but just as a quick link that might be helpful, I would recommend exploring the wp_set_object_terms() function that WordPress provides. You can read about this function here → https://codex.wordpress.org/Function_Reference/wp_set_object_terms
Best of luck with your customizing!
— George
February 19, 2016 at 8:35 am #1078214Support 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 ‘Hook on Facebook event created’ is closed to new replies.
