Hook on Facebook event created

Home Forums Calendar Products Event Aggregator Hook on Facebook event created

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1061755
    Keith
    Participant

    I 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.

    #1061758
    George
    Participant

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

    #1061770
    Keith
    Participant

    Hi 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,
    Keith

    #1061823
    George
    Participant

    Sure 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

    #1078214
    Support Droid
    Keymaster

    This 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.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Hook on Facebook event created’ is closed to new replies.