Forum Replies Created
-
AuthorPosts
-
December 15, 2014 at 2:43 am in reply to: Error calling tribe_eb_is_live_event & tribe_eb_get_ticket_count #918276crhallenParticipant
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’] ); -
AuthorPosts