duekerla

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • duekerla
    Participant

    Hi AndrĂ¡s,

    Yup, it still works.

    One issue with the code that’s displayed in that post, however. Not quite sure how this happened, but a number of characters have been turned into their HTML code equivalents. That would be fine if this were HTML, but it’s not–it’s pure PHP. For example, the code as written reads (line 5):

    $event = $api->get_event( $post_id );

    It should read:

    $event = $api->get_event( $post_id );

    Similar problems exist throughout the code, bringing down the website with syntax errors. Once I translated all the HTML codes to the characters they represented, things worked fine. Here’s the result, in case it’s useful to someone else in the future:

    /* RENDER IFRAME EVEN WHEN EVENTBRITE EVENT IS SET TO PRIVATE */
    function eb_iframe_show_even_if_private() {
        $post_id  = get_the_ID();
        $api = tribe( 'eventbrite.api' );
        $event = $api->get_event( $post_id );
    
        if ( ! $event ) {
            return;
        }
    
        $event_id = $event->id;
    
        $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 ) );
    
        $html = '';
    
        if (
            ! empty( $event_id ) &&
            $api->is_live( $post_id ) &&
            tribe_event_show_tickets( $post_id )
        ) {
            $html = 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">Event registration</a>
                                <span style="color:#ddd"> powered by </span>
                                <a target="_blank" href="http://www.eventbrite.com?ref=etckt">Eventbrite</a>
                            </div>
                        </div>', $event_id, $iframe_url );
        }
    
        $html = apply_filters( 'tribe_template_factory_debug', $html, 'Tribe__Events__Eventbrite__Template::the_tickets' );
        return apply_filters( 'tribe_events_eb_iframe_html', $html, $event_id, $post_id );
    }
    
    add_filter( 'tribe_events_eventbrite_the_tickets', 'eb_iframe_show_even_if_private' );

    Bob (website support for duekerla)

Viewing 1 post (of 1 total)