Tribe__Tickets__Metabox::ajax_attendee_uncheckin()

Handles the check-in ajax call, and calls the uncheckin method.

Contents


Source

File: src/Tribe/Metabox.php

	public function ajax_attendee_uncheckin() {
		$event_id    = Tribe__Utils__Array::get( $_POST, 'event_ID', false );
		$attendee_id = Tribe__Utils__Array::get( $_POST, 'attendee_id', false );

		if ( empty( $attendee_id ) ) {
			wp_send_json_error( __( 'The attendee ID is missing from the request parameters.', 'event-tickets' ) );
		}

		$provider = Tribe__Utils__Array::get( $_POST, 'provider', false );

		if ( empty( $provider ) || ! $this->module_is_valid( $provider ) ) {
			wp_send_json_error( esc_html__( 'Commerce Module invalid', 'event-tickets' ) );
		}

		$provider = call_user_func( array( $provider, 'get_instance' ) );

		if (
			empty( $_POST['nonce'] )
			|| ! wp_verify_nonce( $_POST['nonce'], 'uncheckin' )
			|| ! $this->user_can( 'edit_posts', $attendee_id )
		) {
			wp_send_json_error( "Cheatin' huh?" );
		}

		// Pass the control to the child object
		$did_uncheckin = $provider->uncheckin( $attendee_id );

		$provider->clear_attendees_cache( $event_id );

		wp_send_json_success( $did_uncheckin );
	}

Top ↑

Changelog

Changelog
Version Description
4.6.2
4.12.3 Introduced.