Tribe__Tickets__REST__V1__Main::rest_event_data_add_attendance( array $data, WP_Post $event )
Filters the data that will be returned for a single event, adding attendance.
Contents
Parameters
- $data
-
(array) (Required) The data that will be returned in the response.
- $event
-
(WP_Post) (Required) The requested event.
Return
(array) $data The retrieved data, updated with attendance if the request has access.
Source
File: src/Tribe/REST/V1/Main.php
public function rest_event_data_add_attendance( $data, $event ) : array {
if ( ! $this->request_has_manage_access() ) {
return $data;
}
$post_id = $event->ID;
$attendee_count = Tribe__Tickets__Tickets::get_event_attendees_count( $post_id );
$checked_in = Tribe__Tickets__Tickets::get_event_checkedin_attendees_count( $post_id );
$data['attendance'] = [
'total_attendees' => $attendee_count,
'checked_in' => $checked_in,
'not_checked_in' => $attendee_count - $checked_in,
];
return $data;
}
Changelog
| Version | Description |
|---|---|
| 5.5.2 | Introduced. |