Tribe__Tickets__Attendees::include_export_button_title( int $event_id, Tribe__Tickets__Attendees $attendees = null )
Echo the button for the export that appears next to the attendees page title.
Contents
Parameters
- $event_id
-
(int) (Required) The Post ID of the event.
- $attendees
-
(Tribe__Tickets__Attendees) (Optional) The attendees object.
Default value: null
Return
(string) Relative URL for the export.
Source
File: src/Tribe/Attendees.php
public function include_export_button_title( $event_id, Tribe__Tickets__Attendees $attendees = null ){
// Bail if not on the Attendees page.
if ( 'tickets-attendees' !== tribe_get_request_var( 'page' ) ) {
return;
}
// If this function is called from the tabbed-view.php file it does not send over $event_id or $attendees.
// If the $event_id is not an integer we can get the information from the get scope and find the data.
if ( ! is_int( $event_id ) &&
! empty( tribe_get_request_var( 'event_id' ) )
) {
$event_id = tribe_get_request_var( 'event_id' );
$attendees = tribe( 'tickets.attendees' );
$attendees->attendees_table->prepare_items();
}
// Bail early if there are no attendees.
if ( empty( $attendees ) ||
! $attendees->attendees_table->has_items()
) {
return;
}
// Bail early if user is not owner/have permissions.
if ( ! $this->user_can_manage_attendees( 0, $event_id ) ) {
return;
}
echo sprintf(
'<a target="_blank" href="%s" class="export action page-title-action" rel="noopener noreferrer">%s</a>',
esc_url( $export_url = $this->get_export_url() ),
esc_html__( 'Export', 'event-tickets' )
) ;
}
Changelog
| Version | Description |
|---|---|
| 5.1.7 | Introduced. |