Tribe__Tickets__Tickets::get_event_attendees_by_args( int $post_id, array $args = array() )
Returns all the attendees for an event with filtered by arguments. Queries all registered providers.
Contents
Parameters
- $post_id
-
(int) (Required) ID of parent "event" post.
- $args
-
(array) (Optional) List of arguments to filter attendees by.
- 'return_total_found'
(boolean) Whether to return total_found count in an array along with list of attendees. Default is off. - 'page'
(int) Page number of attendees to return. Default is page 1. - 'per_page'
(int) How many attendees to return per page. Default is all. - 'fields'
(string) Which fields to return. Default is all. - 'by'
(array) List of ORM->by() filters to use. [what=>[args...]], [what=>arg], or [[what,args...]] format. - 'where_multi'
(array) List of ORM->where_multi() filters to use. [[what,args...]] format.
Default value: array()
- 'return_total_found'
Return
(array) List of attendees and total_found.
Source
File: src/Tribe/Tickets.php
public static function get_event_attendees_by_args( $post_id, $args = [] ) { $attendee_data = [ 'total_found' => 0, 'attendees' => [], ]; if ( empty( $post_id ) ) { return $attendee_data; } $provider = 'default'; if ( ! empty( $args['provider'] ) ) { $provider = $args['provider']; } /** @var Tribe__Tickets__Attendee_Repository $repository */ $repository = tribe_attendees( $provider ); // Limit by post ID. $repository->by( 'event', $post_id ); self::pass_args_to_repository( $repository, $args ); if ( ! empty( $args['return_total_found'] ) ) { $repository->set_found_rows( true ); } $attendee_posts = $repository->all(); if ( ! empty( $args['return_total_found'] ) ) { $attendee_data['total_found'] = $repository->found(); } $attendee_data['attendees'] = self::get_attendees_from_modules( $attendee_posts, $post_id ); return $attendee_data; }
Changelog
Version | Description |
---|---|
5.5.9 | Move the logic to get_attendees_by_args and use the method to return the attendees. |
4.10.6 | Introduced. |