Additional Editing in WP of Eventbrite Event (Part 3)

Home Forums Ticket Products Eventbrite Tickets Additional Editing in WP of Eventbrite Event (Part 3)

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1293898
    Brandon
    Participant

    This is a continuation of this support ticket and this follow-up support ticket, both of which are now closed to new replies. Please read through those support tickets for context on this issue.

    I need the ability to import Eventbrite events then do additional edits within WP without updating back to Eventbrite. The previous fix (suggested in the follow-up support ticket linked above) was working for me until recently. I would do an import from Eventbrite, then I could make any changes I wanted to make to the description within WP; save; and Eventbrite was not updated (which is what I want).

    This is the code that is in my custom functions which was working at one point…

    /*
    This function disables syncing from Events Calendar PRO to Eventbrite.
    */
    function citylife_inhibit_communication_with_eventbrite() {
        // Do nothing if Eventbrite Tickets is not activated
        if ( ! class_exists( 'Tribe__Events__Tickets__Eventbrite__Main' ) ) return;
     
        // Remove update callback
        $callback = array( Tribe__Events__Tickets__Eventbrite__Main::instance(), 'action_sync_event' );
        remove_action( 'tribe_events_update_meta', $callback, 20 );
    }
    add_action( 'wp_loaded', 'citylife_inhibit_communication_with_eventbrite', 100 );

    I just did an import from Eventbrite; updated the description within WP; saved; the new description was saved to my Eventbrite event (which I DO NOT want). I’m not sure when this code snippet stopped working for me.

    I am currently running:
    The Events Calendar v4.5.3
    The Events Calendar PRO v4.4.9
    The Events Calendar: Eventbrite Tickets v4.4.4
    WordPress 4.7.5

    #1295607
    Cliff
    Member

    Hi, Brandon.

    I’m guessing this is due to our changing to using the tribe() and tribe_singleton() functions.

    Therefore, please replace Tribe__Events__Tickets__Eventbrite__Main::instance() with tribe( 'eventbrite.main' ) and see if that works.

    Please let me know how this goes for you.

    #1310583
    Brandon
    Participant

    Sorry for the delay in my response. Unfortunately, this is still not working for me.

    I made the change as suggested which resulted in this code…

    /*
    This function disables syncing from Events Calendar PRO to Eventbrite.
    */
    function inhibit_communication_with_eventbrite() {
        // Do nothing if Eventbrite Tickets is not activated
        if ( ! class_exists( 'Tribe__Events__Tickets__Eventbrite__Main' ) ) return;
     
        // Remove update callback
        $callback = array( tribe( 'eventbrite.main' ), 'action_sync_event' );
        remove_action( 'tribe_events_update_meta', $callback, 20 );
    }
    add_action( 'wp_loaded', 'inhibit_communication_with_eventbrite', 100 );

    From within WordPress, I then updated the description of an event that I had previously imported from Eventbrite. After saving, the changes were also pushed to Eventbrite. I DO NOT WANT THIS. We have additional content that we need on our website that we DO NOT want on Eventbrite.

    Looking at the code, I noticed that the old class name “Tribe__Events__Tickets__Eventbrite__Main” was still being referenced. So I made the following change which is the state of my current code…

    /*
    This function disables syncing from Events Calendar PRO to Eventbrite.
    */
    function inhibit_communication_with_eventbrite() {
    	// Do nothing if Eventbrite Tickets is not activated
        if ( ! class_exists( 'eventbrite' ) ) return;
     
        // Remove update callback
        $callback = array( tribe( 'eventbrite.main' ), 'action_sync_event' );
        remove_action( 'tribe_events_update_meta', $callback, 20 );
    }
    add_action( 'wp_loaded', 'inhibit_communication_with_eventbrite', 100 );

    After this latest change, the problem still exists. When I make a change to an event in WordPress, it still updates to the associated Eventbrite event.

    Please provide a code fix (or even include as a feature in the plugin) to prevent the syncing back to Eventbrite.

    Thanks!

    #1310602
    Brandon
    Participant

    I seem to have solved this on my own. Reading through the code I see that tribe is a function and not a class so I replaced class_exists with function_exists and the code is now working. This is now the current state…

    /*
    This function disables syncing from Events Calendar PRO to Eventbrite.
    */
    function inhibit_communication_with_eventbrite() {
    	// Do nothing if Eventbrite Tickets is not activated
        if ( ! function_exists( 'tribe' ) ) return;
     
        // Remove update callback
        $callback = array( tribe( 'eventbrite.main' ), 'action_sync_event' );
        remove_action( 'tribe_events_update_meta', $callback, 20 );
    }
    add_action( 'wp_loaded', 'inhibit_communication_with_eventbrite', 100 );

    However, I feel like the logic in this code snippet is no longer accomplishing the same result from the original snippet that you guys provided (see the original support ticket). The function_exists condition at the beginning should exit out if the eventbrite plugin is not activated. I’m assuming that the tribe function is used across all of the tribe plugins and, therefore, would still exist if the Eventbrite plugin was not activated.

    Please provide an update to this condition.

    Thanks.

    #1310622
    Brandon
    Participant

    I already tried posting this follow-up message once but I don’t see it on my end. Trying again…

    I seem to have solved this on my own. Reading through the code I see that tribe is a function and not a class so I replaced class_exists with function_exists and the code is now working. This is now the current state…

    /*
    This function disables syncing from Events Calendar PRO to Eventbrite.
    */
    function inhibit_communication_with_eventbrite() {
    	// Do nothing if Eventbrite Tickets is not activated
        if ( ! function_exists( 'tribe' ) ) return;
     
        // Remove update callback
        $callback = array( tribe( 'eventbrite.main' ), 'action_sync_event' );
        remove_action( 'tribe_events_update_meta', $callback, 20 );
    }
    add_action( 'wp_loaded', 'inhibit_communication_with_eventbrite', 100 );

    However, I feel like the logic in this code snippet is no longer accomplishing the same result from the original snippet that you guys provided (see the original support ticket). The function_exists condition at the beginning should exit out if the eventbrite plugin is not activated. I’m assuming that the tribe function is used across all of the tribe plugins and, therefore, would still exist if the Eventbrite plugin was not activated.

    Please provide an update to this condition.

    Thanks.

    #1311062
    Cliff
    Member

    Good for you!

    That original snippet you linked to included

    class_exists( 'Event_Tickets_PRO' )

    Which checked for Events Calendar PRO, not Eventbrite Tickets.

    Event_Tickets_PRO actually isn’t a valid class anymore; it’d be Tribe__Events__Pro__Main now.

    Anyway, you could still check if Eventbrite Tickets is active via

    class_exists( 'Tribe__Events__Tickets__Eventbrite__Main' )

    Please let me know if you have any follow-up questions on this topic.

    #1323934
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Additional Editing in WP of Eventbrite Event (Part 3)’ is closed to new replies.