Tribe__Tickets_Plus__Commerce__EDD__Main::render_ticket_print_view()

Render the print ticket view, based on the email template

Contents


Return

(void)


Top ↑

Source

File: src/Tribe/Commerce/EDD/Main.php

	public function render_ticket_print_view() {

		// Is this a print-ticket request?
		if ( ! isset( $_GET['eddfile'] ) || ! isset( $_GET['edd_action'] ) || $_GET['edd_action'] !== 'print_ticket' ) {
			return;
		}

		// As of EDD 2.3 a token should be available to help verify if the link is valid
		if ( ! $this->passed_token_validation( $_GET ) ) {
			return;
		}

		// Decompile the eddfile argument into its base components
		$order_parts = array_values( explode( ':', rawurldecode( $_GET['eddfile'] ) ) );

		// We expect there to be at least two components (payment and download IDs)
		if ( count( $order_parts ) < 2 ) {
			return;
		}

		$payment_id = $order_parts[0];
		$attendees  = $this->get_attendees_by_id( $payment_id );

		$content = $this->generate_tickets_email_content( $attendees );
		$content .= '<script>window.onload = function(){ window.print(); }</script>';
		echo $content;
		exit;
	}