Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Automattic

    (@automattic)

    Hm, you could approach it a couple of different ways (all of which would need some development, nothing built-in to the plugin can do that automatically).

    One option is to filter the results at the API level with the eventbrite_api_call_response filter. You could also handle it in the templates, by looping over the $events results and checking your condition before the events get processed by the WordPress Loop. A more elegant extension of that would be to extend the Eventbrite_Query class with a new query argument, so that the class itself does that filtering, and the only thing you’d need to add to the template is the new argument.

    Thread Starter dev grl

    (@siqve006)

    Would this work for two separate pages though. One will feed public and I need another to feed private only.

    Plugin Author Automattic

    (@automattic)

    Sure; you could make a new page template that duplicates Eventbrite Events, only with the different query requirements, or you could assign Eventbrite Events to both pages, and have logic check in the template to see which page it’s on (public or private), and adjust the query accordingly.

    Thread Starter dev grl

    (@siqve006)

    I think I need to clarify, I’m looking to feed private live events to a page that is also hidden unless someone is logged in to see it. Is that possible? Can you only feed events listed as public?

    Plugin Author Automattic

    (@automattic)

    Ah yes. To do that, I’d suggest setting the page with your events to private visibility, and then for the Eventbrite_Query call in your template, set 'display_private' => true.

    Thread Starter dev grl

    (@siqve006)

    It appears this method is pulling in both public and private now. Is there a way to just pull in the private?

    Plugin Author Automattic

    (@automattic)

    Right, yes, you would still need to somehow filter the results of the Eventbrite_Query call in the template. There’s a listed property that looks like it could help. So in the template you could do something like (untested faux-code):

    // Set up and call our Eventbrite query.
    $events = new Eventbrite_Query( apply_filters( 'eventbrite_query_args', array(
    	'display_private' => true,
    ) ) );
    
    // Remove any public listed events.
    $events = array_filter( $events, function( $event ) {
    	return ! $event->listed;
    } );
    
    // Continue with the Loop.
    if ( $events->have_posts() ) :
    ...
    Plugin Author Automattic

    (@automattic)

    Hi dev grl, any luck with this?

    Thread Starter dev grl

    (@siqve006)

    Not yet no, $events is not an array. $events is an object subclassed from WP_query so still not working.

    Plugin Author Automattic

    (@automattic)

    Oh right, your events would be in $events->posts.

    Plugin Author Automattic

    (@automattic)

    Closing; just open a new thread if you’re still having issues.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Filter events’ is closed to new replies.