Error calling tribe_eb_is_live_event & tribe_eb_get_ticket_count

Home Forums Ticket Products Eventbrite Tickets Error calling tribe_eb_is_live_event & tribe_eb_get_ticket_count

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #913034
    crhallen
    Participant

    I am trying to call a series of the eventbrite template tags (from https://theeventscalendar.com/support/documentation-eventbrite-tickets/eventbrite-template-tags/) in functions.php as below:


    $added = array(
    'is_allday' => tribe_get_all_day( $postId ),
    'is_multiday' => tribe_is_multiday( $postId ),
    'event_start' => tribe_get_start_date( $postId, false, 'M j, g:i A' ),
    'event_end' => tribe_get_end_date( $postId, false, 'M j, g:i A' ),
    'organiser_name' => tribe_get_organizer( $postId ),
    'venue_name' => tribe_get_venue( $postId ),
    'eb_id' => tribe_eb_get_id( $postId ),
    'eb_show_tickets' => tribe_event_show_tickets( $postId ),
    'eb_is_live' => tribe_eb_is_live_event( $postId ),
    'eb_ticket_count' => tribe_eb_get_ticket_count( $postId ),
    'event_cost' => tribe_get_cost( $postId ),
    );

    Trying each one individually, most work but I am encountering the following errors:

    tribe_eb_get_id( $postId ) returns:

    PHP Strict Standards: Non-static method Event_Tickets_PRO::getEventId() should not be called statically in /wp-content/plugins/the-events-calendar-eventbrite-tickets/public/template-tags.php on line 31
    PHP Strict Standards: Non-static method Event_Tickets_PRO::getEventId() should not be called statically in /wp-content/plugins/the-events-calendar-eventbrite-tickets/public/template-tags.php on line 31

    tribe_eb_is_live_event( $postId ) returns:

    PHP Strict Standards: Non-static method Event_Tickets_PRO::isLive() should not be called statically in /wp-content/plugins/the-events-calendar-eventbrite-tickets/public/template-tags.php on line 43
    PHP Fatal error: Using $this when not in object context in /wp-content/plugins/the-events-calendar-eventbrite-tickets/lib/tribe-eventbrite.class.php on line 1863

    tribe_eb_get_ticket_count( $postId ) returns:

    PHP Strict Standards: Non-static method Event_Tickets_PRO::sendEventBriteRequest() should not be called statically in /wp-content/plugins/the-events-calendar-eventbrite-tickets/public/template-tags.php on line 16
    PHP Fatal error: Using $this when not in object context in /wp-content/plugins/the-events-calendar-eventbrite-tickets/lib/tribe-eventbrite.class.php on line 1691

    While the Strict Standard errors are not of great concern (right?), can you help me solve the Fatal Errors?

    Thanks

    #913284
    Brian
    Keymaster

    Hello,

    Thanks for using our plugins. I can try to help out here, in 3.9 we changed the methods in the class that our template tags are using such as this one:

    tribe_eb_is_live_event( $postId )

    That is causing the fatal errors.

    You can use this snippet instead until this is resolved:

    https://gist.github.com/jesseeproductions/9f96d2ef2dc8e1c41922

    Let me know if you have any follow up questions.

    Thanks

    *This post was edited to fix issues reported by ibex in this ticket:

    https://theeventscalendar.com/support/forums/topic/tribe_eb_is_live_event-throws-a-fatal-error-in-the-latest-update/

    #918276
    crhallen
    Participant

    OK. So I needed to create an object as the methods were not declared as static in the class.

    For the first two it is more simple:

    //create new object
    $eventobj = new Event_Tickets_PRO();
    //call the methods within the class
    $eb_id = $eventobj->getEventId( $postId ),
    $eb_is_live = $eventobj->isLive( $postId ),

    For the last one, to count the number of eventbrite ticket types:

    //use api call to get all eventbrite data
    function tribe_eb_all( $postId = null, $eventobj ) {
    $postId = TribeEvents::postIdHelper( $postId );
    if ( $EventBriteId = get_post_meta( $postId, ‘_EventBriteId’, true ) ) {
    $event = $eventobj->sendEventBriteRequest( ‘event_get’, ‘id=’ . $EventBriteId, $postId );
    return $event;
    } else {
    return false;
    }
    }
    //create new object and call the function
    $eventobj = new Event_Tickets_PRO();
    $event = tribe_eb_all( $postId, $eventobj );
    //count the number of ticket types
    $eb_no_of_ticket_types => count( $event[‘event’][‘tickets’] );

    #918428
    Brian
    Keymaster

    Great, thanks for sharing your coding with everyone.

    I know someone will find that useful.

    I am going to close this ticket, but if you need anything else related to this topic or another please post a new topic on the forum and we can help you out.

    Thanks

    #922494
    Brian
    Keymaster

    This ticket is closed, but has been added to a bug ticket. This bug was found thanks to the post by ibex here:

    https://theeventscalendar.com/support/forums/topic/tribe_eb_is_live_event-throws-a-fatal-error-in-the-latest-update/#post-922481

    The original post was also edited to remove information that was not correct about my original assessment.

    Due to a change in the methods in 3.9 the following template tags in EventBrite now return fatal errors of not in object context.

    • tribe_eb_get_ticket_count()
    • tribe_eb_is_live_event()
    • tribe_eb_event_status()
    • tribe_eb_event_list_attendees()

    crhallen your coding is a way around this bug until we can fix this issue.

    We will update this ticket once we have information on a solution.

    If you have issues related to this please create a new ticket and we can help you out.

    #933438
    Leah
    Member

    Hi there,

    Thanks for your patience while we looked into this problem. We are working on a secondary maintenance release that addresses this issue. Keep an eye on your site for a new update to version 3.9.1. We’ve tested this release thoroughly and it should resolve the reported issue. However, if you are still running into trouble please start a new thread and we will respond as soon as possible. Thanks again for your patience and support!

    Best,
    Leah
    and the team at Modern Tribe

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Error calling tribe_eb_is_live_event & tribe_eb_get_ticket_count’ is closed to new replies.