Tribe__Tickets_Plus__Commerce__WooCommerce__Main::get_attendee( $attendee, $post_id )
{@inheritdoc}
Source
File: src/Tribe/Commerce/WooCommerce/Main.php
public function get_attendee( $attendee, $post_id = 0 ) {
if ( is_numeric( $attendee ) ) {
$attendee = get_post( $attendee );
}
if ( ! $attendee instanceof WP_Post || $this->attendee_object !== $attendee->post_type ) {
return false;
}
$order_id = get_post_meta( $attendee->ID, $this->attendee_order_key, true );
$order_item_id = get_post_meta( $attendee->ID, $this->attendee_order_item_key, true );
$checkin = get_post_meta( $attendee->ID, $this->checkin_key, true );
$optout = (bool) get_post_meta( $attendee->ID, $this->attendee_optout_key, true );
$security = get_post_meta( $attendee->ID, $this->security_code, true );
$product_id = get_post_meta( $attendee->ID, $this->attendee_product_key, true );
$user_id = get_post_meta( $attendee->ID, $this->attendee_user_id, true );
//$ticket_sent = (bool) get_post_meta( $attendee->ID, $this->attendee_ticket_sent, true );
if ( empty( $product_id ) ) {
return false;
}
$product = get_post( $product_id );
$product_title = ( ! empty( $product ) ) ? $product->post_title : get_post_meta( $attendee->ID, $this->deleted_product, true ) . ' ' . __( '(deleted)', 'wootickets' );
$ticket_unique_id = get_post_meta( $attendee->ID, '_unique_id', true );
$ticket_unique_id = $ticket_unique_id === '' ? $attendee->ID : $ticket_unique_id;
$meta = '';
if ( class_exists( 'Tribe__Tickets_Plus__Meta' ) ) {
$meta = get_post_meta( $attendee->ID, Tribe__Tickets_Plus__Meta::META_KEY, true );
// Process Meta to include value, slug, and label
if ( ! empty( $meta ) ) {
$meta = $this->process_attendee_meta( $product_id, $meta );
}
}
// Add the Attendee Data to the Order data
$attendee_data = array_merge( $this->get_order_data( $order_id ), array(
'ticket' => $product_title,
'attendee_id' => $attendee->ID,
'order_item_id' => $order_item_id,
'security' => $security,
'product_id' => $product_id,
'check_in' => $checkin,
'optout' => $optout,
'user_id' => $user_id,
//'ticket_sent' => $ticket_sent,
// Fields for Email Tickets
'event_id' => get_post_meta( $attendee->ID, $this->attendee_event_key, true ),
'ticket_name' => ! empty( $product ) ? $product->post_title : false,
'holder_name' => $this->get_holder_name( $attendee, $order_id ),
'ticket_id' => $ticket_unique_id,
'qr_ticket_id' => $attendee->ID,
'security_code' => $security,
// Attendee Meta
'attendee_meta' => $meta,
) );
/**
* Allow users to filter the Attendee Data
*
* @param array An associative array with the Information of the Attendee
* @param string What Provider is been used
* @param WP_Post Attendee Object
* @param int Post ID
*
*/
$attendee_data = apply_filters( 'tribe_tickets_attendee_data', $attendee_data, 'woo', $attendee, $post_id );
return $attendee_data;
}