Created
March 18, 2014 11:04
-
-
Save dbarkley/9617943 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function custom_espresso_ticket_links($registration_id, $attendee_id, $txn_id, $email = FALSE) { | |
global $wpdb; | |
$sql = "SELECT * FROM " . EVENTS_ATTENDEE_TABLE; | |
if (espresso_is_primary_attendee($attendee_id) != true) { | |
$sql .= " WHERE id = '" . $attendee_id . "' "; | |
} else { | |
$sql .= " WHERE txn_id = '" . $txn_id . "' "; | |
} | |
//echo $sql; | |
$attendees = $wpdb->get_results($sql); | |
$ticket_link = ''; | |
if ($wpdb->num_rows > 0) { | |
$break = '<br />'; | |
$group = $wpdb->num_rows > 1 ? sprintf(__('Tickets Purchased (%s):', 'event_espresso'), $wpdb->num_rows).$break : __('Download/Print Ticket:', 'event_espresso').$break; | |
foreach ($attendees as $attendee) { | |
$event_query = $wpdb->get_results("SELECT * FROM wp_events_detail WHERE id = $attendee->event_id"); | |
$event = $event_query[0]; | |
$event_name = $event->event_name; | |
$ticket_url = get_option('siteurl') . "/?download_ticket=true&id=" . $attendee->id . "&r_id=" . $attendee->registration_id; | |
if (function_exists('espresso_ticket_launch')) { | |
$ticket_url = espresso_ticket_url($attendee->id, $attendee->registration_id); | |
} | |
$ticket_link .= '<a href="' . $ticket_url . '" target="_blank">' . $event_name . ": ". $attendee->price_option . '</a>' . $break; | |
} | |
if ($email == TRUE){ | |
$text = '<p>' . $group . $ticket_link .'</p>'; | |
}else{ | |
$text = $ticket_link; | |
} | |
return $text; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment