Tribe__Tickets__RSVP::get_attendee( $attendee, $post_id )
{@inheritdoc}
Get all the attendees for post type. It returns an array with the following fields:
order_id
order_status
purchaser_name
purchaser_email
optout
ticket
attendee_id
security
product_id
check_in
provider
Source
File: src/Tribe/RSVP.php
public function get_attendee( $attendee, $post_id = 0 ) {
if ( is_numeric( $attendee ) ) {
$attendee = get_post( $attendee );
}
if ( ! $attendee instanceof WP_Post || self::ATTENDEE_OBJECT !== $attendee->post_type ) {
return false;
}
$checkin = get_post_meta( $attendee->ID, $this->checkin_key, true );
$security = get_post_meta( $attendee->ID, $this->security_code, true );
$product_id = get_post_meta( $attendee->ID, self::ATTENDEE_PRODUCT_KEY, true );
$optout = (bool) get_post_meta( $attendee->ID, self::ATTENDEE_OPTOUT_KEY, true );
$status = get_post_meta( $attendee->ID, self::ATTENDEE_RSVP_KEY, true );
$status_label = $this->tickets_view->get_rsvp_options( $status );
$user_id = get_post_meta( $attendee->ID, self::ATTENDEE_USER_ID, true );
$ticket_sent = (bool) get_post_meta( $attendee->ID, self::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)', 'event-tickets' );
$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', false ) ) {
$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 );
}
}
$attendee_data = array_merge( $this->get_order_data( $attendee->ID ), array(
'optout' => $optout,
'ticket' => $product_title,
'attendee_id' => $attendee->ID,
'security' => $security,
'product_id' => $product_id,
'check_in' => $checkin,
'order_status' => $status,
'order_status_label' => $status_label,
'user_id' => $user_id,
'ticket_sent' => $ticket_sent,
// Fields for Email Tickets
'event_id' => get_post_meta( $attendee->ID, self::ATTENDEE_EVENT_KEY, true ),
'ticket_name' => ! empty( $product ) ? $product->post_title : false,
'holder_name' => get_post_meta( $attendee->ID, $this->full_name, true ),
'holder_email' => get_post_meta( $attendee->ID, $this->email, true ),
'order_id' => $attendee->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
*
* @var array An associative array with the Information of the Attendee
* @var string What Provider is been used
* @var WP_Post Attendee Object
* @var int Post ID
*
*/
$attendee_data = apply_filters( 'tribe_tickets_attendee_data', $attendee_data, 'rsvp', $attendee, $post_id );
return $attendee_data;
}