Tribe__Tickets__Tickets::get_attendees_by_args( array $args = array(), int $post_id )
Returns all the attendees 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_attendees_by_args( $args = [], $post_id = 0 ) {
$attendee_data = [
'total_found' => 0,
'attendees' => [],
];
$provider = 'default';
if ( ! empty( $args['provider'] ) ) {
$provider = $args['provider'];
}
/** @var Tribe__Tickets__Attendee_Repository $repository */
$repository = tribe_attendees( $provider );
// Limit by post ID.
if ( ! empty( $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 | Introduced. |