Skip to content

Instantly share code, notes, and snippets.

@barryhughes
Created June 23, 2015 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save barryhughes/345a6b12ce9c44f573fd to your computer and use it in GitHub Desktop.
Save barryhughes/345a6b12ce9c44f573fd to your computer and use it in GitHub Desktop.
Eventbrite API change: temp fix - remove when no longer needed - can be added to the theme's functions.php file etc
/**
* Temporary solution to a problem where the tickets form does not show, due to a recent
* Eventbrite API change.
*
* @param string $html
* @param int $event_id
* @param int $post_id
* @return string
*/
function temp_fix_37178( $html, $event_id, $post_id ) {
$api = Tribe__Events__Tickets__Eventbrite__API::instance();
$event = $api->get_event( $post_id );
if ( ! empty( $html ) ) return $html;
if ( 'live' !== $event->status ) return $html;
$iframe_url = ( is_ssl() ? 'https://' : 'http://' ) . 'www.eventbrite.com/tickets-external?eid=%s&ref=etckt&v=2';
$iframe_url = apply_filters( 'tribe_events_eb_iframe_url', sprintf( $iframe_url, $event_id ) );
return sprintf(
'<div class="eventbrite-ticket-embed" style="width:100%%;text-align:left">
<iframe id="eventbrite-tickets-%1$s" src="%2$s" style="height:200px;width:100%%;overflow:auto;"></iframe>
<div style="font-family:Helvetica, Arial;font-size:10px;padding:5px 0 5px;margin:2px;width:100%%;text-align:left">
<a target="_blank" href="http://www.eventbrite.com/features?ref=etckt" style="color:#ddd;text-decoration:none">Event registration</a>
<span style="color:#ddd"> powered by </span>
<a target="_blank" href="http://www.eventbrite.com?ref=etckt" style="color:#ddd;text-decoration:none">Eventbrite</a>
</div>
</div>', $event_id, $iframe_url
);
}
add_filter( 'tribe_events_eb_iframe_html', 'temp_fix_37178', 10, 3 );
@barryhughes
Copy link
Author

Note: this should allow the ticket form for imported events to display - it does not solve a related issue impeding the ability to make changes via the local event editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment