<?php
/**
* MT - Event Tickets Plus (ET+) - Redirect to WebQR.com after scanning a QR code (pseudo-kiosk / self check-in mode)
*
* Useful for self-service "kiosk" mode for ET+ QR code check-ins.
* Sign into wp-admin as a user that has permission to check-in QR codes.
* In the same web browser, visit WebQR.com and then await your attendees.
* If the check-in was successful (or ticket was previously checked-in already), it will redirect back to WebQR.com to be ready for the next attendee check-in.
* If the check-in was unsuccessful, it will do its default action of redirecting to the event's public/front-end single page view. You may want to modify this to go to a page that displays something like, "Error with check-in. Please see a staff member before proceeding."
* Overall, make sure to think through and test things before putting into production for your event's actual check-ins.
* Note that WebQR.com is not supported, guaranteed, maintained, owned by, or affiliated with Modern Tribe.
*
* @link https://gist.github.com/cliffordp/f1e6efdd77560bb9d27df38e99d73ec3
* @link https://theeventscalendar.com/support/forums/topic/self-checkin-capability/
*
* @param string $url URL to redirect to, gets escaped upstream
* @param int $event_id Event Post ID
* @param int $ticket_id Ticket Post ID
* @param bool $user_had_access Whether or not the logged-in user has permission to perform check-ins
*
* @return string
*/
add_filter( 'tribe_tickets_plus_qr_handle_redirects', 'cliff_et_plus_qr_check_in_redirect', 10, 4 );
function cliff_et_plus_qr_check_in_redirect( $url, $event_id, $ticket_id, $user_had_access ) {
if ( ! empty( $user_had_access ) ) {
$url = 'https://webqr.com/';
}
return $url;
}