The Event Tickets Plus App communicates with your WordPress site through the REST API. The snippets on this page let you modify what the app receives.
The customizations in this article are all code snippets. Add them to your child theme’s functions.php file or use the Code Snippets plugin. If code snippets are new to you, start with Using Code Snippets to Customize The Events Calendar for a walkthrough.
Hiding Attendee Information in the App
In some scenarios, it’s important not to display attendee information on the scan result or within the Events screen of the app — for privacy reasons, for staff with limited access rights, or to comply with an internal policy. The snippet below filters the REST API responses the app receives, replacing attendee names, emails, and payment details with placeholder values before they reach the app.
<?php //* Do NOT include the opening php tag
add_filter(
'rest_request_after_callbacks',
'tec_tickets_maybe_hide_attendee_information_for_app',
10,
3
);
/**
* Maybe hide information for the ET+ APP.
*
* @param WP_REST_Response|WP_HTTP_Response|WP_Error|mixed $response Result to send to the client.
* @param array $handler Route handler used for the request.
* @param WP_REST_Request $request Request used to generate the response.
*
* @return WP_REST_Response|WP_HTTP_Response|WP_Error|mixed
*/
function tec_tickets_maybe_hide_attendee_information_for_app( $response, array $handler, \WP_REST_Request $request ) {
if ( empty( $request->get_header( 'App-version' ) ) ) {
return $response;
}
if ( '/tribe/tickets/v1/attendees' === $request->get_route() ) {
// Hide the attendee information from the attendee endpoint.
$response = tec_tickets_hide_attendee_information_attendee_endpoint( $response, $handler, $request );
}
if ( '/tribe/tickets/v1/qr' === $request->get_route() ) {
// Update QR response, hiding the attendee information.
$response = tec_tickets_hide_attendee_information_qr_endpoint( $response, $handler, $request );
}
if ( '/tribe/events/v1/events' === $request->get_route() ) {
// If you want to hide Events for the APP, or do something with this endpoint.
}
return $response;
}
/**
* Hide the attendee information from the attendees endpoint.
*/
function tec_tickets_hide_attendee_information_attendee_endpoint( $response, array $handler, \WP_REST_Request $request ) {
if ( empty( $response->data['attendees'] ) ) {
return $response;
}
foreach ( $response->data['attendees'] as &$attendee ) {
$attendee['title'] = 'Hidden Name';
$attendee['email'] = '[email protected]';
$attendee['payment']['currency'] = '';
$attendee['payment']['date'] = '';
$attendee['payment']['price'] = 'Unavailable';
$attendee['information'] = [];
$attendee['information']['Information'] = 'The attendee information is private. For more information please contact the site administrator.';
}
return $response;
}
/**
* Hide the attendee information from the QR endpoint.
*/
function tec_tickets_hide_attendee_information_qr_endpoint( $response, array $handler, \WP_REST_Request $request ) {
if ( empty( $response->data['attendee'] ) ) {
return $response;
}
$response->data['attendee']['title'] = 'Hidden Name';
$response->data['attendee']['email'] = '[email protected]';
$response->data['attendee']['payment']['currency'] = '';
$response->data['attendee']['payment']['date'] = '';
$response->data['attendee']['payment']['price'] = 'Unavailable';
$response->data['attendee']['information'] = [];
$response->data['attendee']['information']['Information'] = 'The attendee information is private. For more information please contact the site administrator.';
return $response;
}
This snippet is also available on GitHub.
Adding the QR Code to the CSV Export
If you want to print badges for your attendees that incorporate the QR code for faster check-in, you can do so with tools like Avery, Label.live, and others. Just make sure you choose an application that can generate QR codes from a CSV file.
The snippet below adds a QR Data column to your event’s Attendees List and its CSV export. That column contains the URL your badge or label-maker application will use to generate the QR code.
add_filter( 'tribe_events_tickets_attendees_csv_export_columns', function( $columns ) {
$columns_to_add = [
'qr_data' => 'QR Data',
];
$columns = array_merge( $columns, $columns_to_add );
return $columns;
}, 100 );
add_filter( 'tribe_events_tickets_attendees_table_column', function ( $value, $item, $column ) {
if ( $column == 'qr_data' ) {
$path = '?event_qr_code=1&ticket_id=' . $item['qr_ticket_id'] .
'&event_id=' . $item['event_id'] .
'&security_code=' . $item['security_code'] .
'&path=' . urlencode( tribe_tickets_rest_url_prefix() . '/qr' );
$value = get_site_url( null, $path, 'https' );
}
return $value;
}, 100, 3 );
add_filter( 'manage_tribe_events_page_tickets-attendees_columns', function ( $column_headers ) {
$new_columns_to_add = [
'qr_data' => 'QR Data',
];
// Add QR Data column immediately after the ticket column.
$insert_at = array_search( 'ticket', array_keys( $column_headers ) );
$column_headers = array_merge(
array_slice( $column_headers, 0, $insert_at, true ),
$new_columns_to_add,
array_slice( $column_headers, $insert_at, null, true )
);
return $column_headers;
}, 100 );
Disabling the “Events” Functionality on the App
In some cases, you may want to hide the Events list from the app entirely — for example, when the app is only used for scanning and you don’t want check-in staff browsing event details.
The snippet below returns a 404 for the app’s Events endpoint, causing the Events screen in the app to display as empty:
<?php //* Do NOT include the opening php tag
add_filter(
'rest_request_after_callbacks',
'tec_tickets_maybe_disable_events_for_app',
10,
3
);
/**
* Maybe disable events for the ET+ APP.
*
* @param WP_REST_Response|WP_HTTP_Response|WP_Error|mixed $response Result to send to the client.
* @param array $handler Route handler used for the request.
* @param WP_REST_Request $request Request used to generate the response.
*
* @return WP_REST_Response|WP_HTTP_Response|WP_Error|mixed
*/
function tec_tickets_maybe_disable_events_for_app( $response, array $handler, \WP_REST_Request $request ) {
if ( empty( $request->get_header( 'App-version' ) ) ) {
return $response;
}
if ( '/tribe/events/v1/events' !== $request->get_route() ) {
return $response;
}
$response = new WP_REST_Response(
[
'code' => 'rest_no_route',
'message' => 'No route was found matching the URL and request method.',
]
);
$response->set_status( 404 );
return $response;
}
This snippet is also available on GitHub.