API add_action which one for event save?

Home Forums Calendar Products Events Calendar PRO API add_action which one for event save?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1106680
    theroad
    Participant

    I’m using add_action( ‘tribe_events_event_save’, ‘sync_event’); to run a function which pushes a saved event to an outside service. The problem is that tribe_events_get_event($event_id) doesn’t pull the event metadata (like start/end dates/times) on the very first time the event is saved. I suspect I need to be using a different tribe action filter but don’t know which. Does anyone know the one I should be using which would allow immediately pulling post event metadata?

    Thanks for your help!

    #1106850
    George
    Participant

    Hey @theroad,

    All of the meta isn’t saved at the point of that action, unfortunately—but you might have some better success by using the action tribe_events_update_meta instead.

    add_action( 'tribe_events_update_meta', 'example_callback', 10, 2 );

    Using this format, you get two arguments in that example_callback callback function, so you can do stuff like this:


    function example_callback( $event_id, $data ) {
    // Stuff with event_id and data....
    }

    We cannot help with custom coding, so you’ll have to investigate this and play around with things a bit, but if you head into that src/Tribe/API.php class file within The Events Calendar, around line 182 you will see the tribe_events_update_meta action I am describing here.

    Check it out—best of luck with your tinkering!

    George

    #1112767
    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 3 posts - 1 through 3 (of 3 total)
  • The topic ‘API add_action which one for event save?’ is closed to new replies.