function espresso_prepare_email_data($attendee_id, $multi_reg, $custom_data = '') { global $wpdb, $org_options; do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, ''); $data = new stdClass(); $data->multi_reg = $multi_reg; //print_r($custom_data); //Create vars for the custom data if (!empty($custom_data)) { extract($custom_data, EXTR_PREFIX_ALL, 'custom_data'); } //echo $custom_data_email_type; //Get the event record if (empty($custom_data_email_type)) { $custom_data_email_type = ''; } $sql = "SELECT ed.* "; isset($org_options['use_venue_manager']) && $org_options['use_venue_manager'] == 'Y' ? $sql .= ", v.name venue_name, v.address venue_address, v.address2 venue_address2, v.city venue_city, v.state venue_state, v.zip venue_zip, v.country venue_country, v.meta venue_meta " : ''; $sql .= " FROM " . EVENTS_DETAIL_TABLE . " ed "; isset($org_options['use_venue_manager']) && $org_options['use_venue_manager'] == 'Y' ? $sql .= " LEFT JOIN " . EVENTS_VENUE_REL_TABLE . " r ON r.event_id = ed.id LEFT JOIN " . EVENTS_VENUE_TABLE . " v ON v.id = r.venue_id " : ''; $sql .= " JOIN " . EVENTS_ATTENDEE_TABLE . " ea ON ea.event_id=ed.id "; $sql .= " WHERE ea.id = '" . $attendee_id . "' "; $data->event = $wpdb->get_row($sql, OBJECT); //Get the attendee record $sql = "SELECT ea.* FROM " . EVENTS_ATTENDEE_TABLE . " ea WHERE ea.id = '" . $attendee_id . "' "; $data->attendee = $wpdb->get_row($sql, OBJECT); //Get the primary/first attendee $data->primary_attendee = espresso_is_primary_attendee($data->attendee->id) == true ? true : false; $data->event->event_meta = unserialize($data->event->event_meta); //Venue variables if (isset($org_options['use_venue_manager']) && $org_options['use_venue_manager'] == 'Y') { $data->event->venue_meta = unserialize($data->event->venue_meta); //Debug //echo "<pre>".print_r($data->event->venue_meta,true)."</pre>"; $data->event->venue_url = $data->event->venue_meta['website']; $data->event->venue_phone = $data->event->venue_meta['phone']; $data->event->venue_image = '<img src="' . $data->event->venue_meta['image'] . '" />'; $data->event->venue_name = $data->event->venue_name; $data->event->address = $data->event->venue_address; $data->event->address2 = $data->event->venue_address2; $data->event->city = $data->event->venue_city; $data->event->state = $data->event->venue_state; $data->event->zip = $data->event->venue_zip; $data->event->country = $data->event->venue_country; } else { $data->event->venue_name = $data->event->venue_title; } //Build the table to hold the event and attendee info $data->table_open = '<table width="100%" border="1" cellpadding = "5" cellspacing="5" style="border-collapse:collapse;">'; $data->table_heading = "<tr><th>" . __('Event Name', 'event_espresso') . "</th><th>" . __('Date', 'event_espresso') . "</th><th>" . __('Time', 'event_espresso') . "</th><th>" . __('Location', 'event_espresso') . "</th></tr>"; $data->table_close = "</table>"; //Clear ticket data $data->qr_code = ''; $data->ticket_link = ''; $data->admin_ticket_link = ''; //Old ticketing system if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . "/ticketing/template.php")) { if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . "/ticketing/functions.php")) { include_once EVENT_ESPRESSO_UPLOAD_DIR . "/ticketing/functions.php"; $data->qr_code = espresso_qr_code(array('attendee_id' => $data->attendee->id, 'event_name' => stripslashes_deep($data->event->event_name), 'attendee_first' => $data->attendee->fname, 'attendee_last' => $data->attendee->lname, 'registration_id' => $data->attendee->registration_id, 'event_code' => $data->event->event_code, 'ticket_type' => $data->attendee->price_option, 'event_time' => $data->attendee->event_time, 'amount_pd' => espresso_attendee_price(array('registration_id' => $data->attendee->registration_id, 'reg_total' => true)))); } $data->ticket_link = espresso_ticket_links($data->attendee->registration_id, $data->attendee->id); $data->admin_ticket_link = $data->ticket_link; } //New ticketing system version 2.0 if (function_exists('espresso_ticket_launch')) { $data->qr_code = espresso_ticket_qr_code(array('attendee_id' => $data->attendee->id, 'event_name' => stripslashes_deep($data->event->event_name), 'attendee_first' => $data->attendee->fname, 'attendee_last' => $data->attendee->lname, 'registration_id' => $data->attendee->registration_id, 'event_code' => $data->event->event_code, 'ticket_type' => $data->attendee->price_option, 'event_time' => $data->attendee->event_time, 'amount_pd' => espresso_attendee_price(array('registration_id' => $data->attendee->registration_id, 'reg_total' => true)))); $data->ticket_link = espresso_ticket_links($data->attendee->registration_id, $data->attendee->id); $data->admin_ticket_link = $data->ticket_link; } //certificate system if (function_exists('espresso_certificate_launch')) { $data->certificate_link = espresso_certificate_links($data->attendee->registration_id, $data->attendee->id); $data->admin_certificate_link = $data->certificate_link; } //Build the address $data->location = ($data->event->address != '' ? $data->event->address : '') . ($data->event->address2 != '' ? '<br />' . $data->event->address2 : '') . ($data->event->city != '' ? '<br />' . $data->event->city : '') . ($data->event->state != '' ? ', ' . $data->event->state : '') . ($data->event->zip != '' ? '<br />' . $data->event->zip : '') . ($data->event->country != '' ? '<br />' . $data->event->country : ''); //Build Google map link $data->google_map_link = espresso_google_map_link(array('address' => $data->event->address, 'city' => $data->event->city, 'state' => $data->event->state, 'zip' => $data->event->zip, 'country' => $data->event->country)); //Registration URL $data->event_url = espresso_reg_url($data->event->id); $data->event_link = '<a href="' . $data->event_url . '">' . stripslashes_deep($data->event->event_name) . '</a>'; //Venue name if (!isset($data->event->venue_name)) { $data->event->venue_name = ''; } //Table of events registered for $data->event_table .= "\n\t\t<tr>\n\t\t\t<td>" . stripslashes_deep($data->event->event_name) . " | " . $data->attendee->price_option . "</td>\n\t\t\t<td>" . event_date_display($data->attendee->start_date) . ' - ' . event_date_display($data->attendee->end_date) . "</td>\n\t\t\t<td>" . event_date_display($data->attendee->event_time, get_option('time_format')) . " - " . event_date_display($data->attendee->end_time, get_option('time_format')) . "</td>\n\t\t\t<td>" . $data->event->venue_name . "<br />{$data->location} <br />{$data->google_map_link}</td>" . ($data->attendee->quantity > 0 ? '<td>' . $data->attendee->quantity . __(' attendees', 'event_espresso') . '</td>' : '') . "</tr>"; //Output custom questions if (function_exists('event_espresso_custom_questions_output')) { //Create the question display $email_questions_r = event_espresso_custom_questions_output(array('attendee_id' => $data->attendee->id, 'all_questions' => TRUE)); if ($email_questions_r != '') { $data->email_questions = '<tr><td colspan = "6">' . $email_questions_r . '</td></tr>'; } $data->event_table .= $data->email_questions; } //Payment URL $payment_url = get_option('siteurl') . "/?page_id=" . $org_options['return_url'] . "&registration_id=" . $data->attendee->registration_id; $data->payment_link = '<a href="' . $payment_url . '">' . __('View Your Payment Details') . '</a>'; // download link $data->invoice_link = '<a href="' . home_url() . '/?download_invoice=true&attendee_id=' . $data->attendee->id . '&registration_id=' . $data->attendee->registration_id . '" target="_blank">' . __('Download PDF Invoice', 'event_espresso') . '</a>'; //Edit attendee link $data->edit_attendee = espresso_edit_attendee($data->attendee->registration_id, $data->attendee->id, $data->attendee->event_id, 'attendee', 'Edit Registration Details'); $data->email_subject = !$data->multi_reg ? $data->event->event_name : $org_options['organization'] . __(' registration confirmation', 'event_espresso'); //Build invoice email if ($custom_data_email_type == 'invoice') { $data->email_subject = $custom_data_invoice_subject; $data->event->conf_mail = $custom_data_invoice_message; $data->event->send_mail = 'Y'; $data->event->email_id = empty($_REQUEST['email_name']) ? '' : $_REQUEST['email_name']; } //Build payment email if ($custom_data_email_type == 'payment') { $data->email_subject = $custom_data_payment_subject; $data->event->conf_mail = $custom_data_payment_message; $data->event->send_mail = 'Y'; } //Build reminder email if ($custom_data_email_type == 'reminder') { $data->email_subject = $custom_data_email_subject; $data->event->conf_mail = $custom_data_email_text; $data->event->send_mail = 'Y'; $data->event->email_id = $custom_data_email_id > 0 ? $custom_data_email_id : ''; } return $data; }
function event_espresso_my_events() { global $espresso_premium; if ($espresso_premium != true) { return; } global $wpdb, $org_options; global $ticketing_installed; require_once 'user_vars.php'; if (!is_user_logged_in()) { if ($login_page != '') { printf('<p>Please <a href="%s">log in</a> to view the events you are registered to attend.</p>', $login_page); } else { echo '<p>You must be logged in to view this page.</p>'; return; } } ?> <div id="configure_organization_form" class="wrap meta-box-sortables ui-sortable"> <div id="event_reg_theme" class="wrap"> <div id="icon-options-event" class="icon32"></div><h2><?php echo _e('My Events Management', 'event_espresso'); ?> </h2> <div id="poststuff" class="metabox-holder"> <?php if (isset($_POST['cancel_registration'])) { if (is_array($_POST['checkbox'])) { while (list($key, $value) = each($_POST['checkbox'])) { $del_attendee = $wpdb->prepare("DELETE FROM " . EVENTS_ATTENDEE_TABLE . " WHERE id = %d", $key); $wpdb->query($del_attendee); $del_attendee_member_rel = $wpdb->prepare("DELETE FROM " . EVENTS_MEMBER_REL_TABLE . " WHERE attendee_id = %d and user_id = %d", $key, $userid); $wpdb->query($del_attendee_member_rel); } } ?> <div id="message" class="updated fade"><p><strong><?php _e('The event(s) have been successfully removed from your account.', 'event_espresso'); ?> </strong></p></div> <?php } ?> <form id="form1" name="form1" method="post" action="<?php echo $_SERVER["REQUEST_URI"]; ?> "> <div style="clear:both; margin-bottom:30px;"></div> <table id="table" class="widefat my_events_table" width="100%"> <thead> <tr> <th class="manage-column column-cb check-column" id="cb" scope="col" style="width:5%;"></th> <th class="manage-column column-title" id="name" scope="col" title="Click to Sort" style="width:10%;"><span><?php _e('Event Name', 'event_espresso'); ?> </span><span class="sorting-indicator"></span></th> <th class="manage-column column-title" id="event" scope="col" title="Click to Sort" style="width: 10%;"> <span><?php _e('Type', 'event_espresso'); ?> </span> <span class="sorting-indicator"></span> </th> <th class="manage-column column-author" id="start" scope="col" title="Click to Sort" style="width:10%;"><span><?php _e('Date', 'event_espresso'); ?> </span><span class="sorting-indicator"></span></th> <th class="manage-column column-date" id="begins" scope="col" title="Click to Sort" style="width:5%;"><span><?php _e('Time', 'event_espresso'); ?> </span><span class="sorting-indicator"></span></th> <th class="manage-column column-date" id="status" scope="col" title="Click to Sort" style="width:5%;"><span><?php _e('Status', 'event_espresso'); ?> </span><span class="sorting-indicator"></span></th> <th class="manage-column column-date" id="attendees" scope="col" title="Click to Sort" style="width:5%;"><span><?php _e('Cost', 'event_espresso'); ?> </span><span class="sorting-indicator"></span></th> <th class="manage-column column-date" id="invoice" scope="col" style="width:5%;"><?php _e('Invoice', 'event_espresso'); ?> </th> <?php echo $ticketing_installed == true ? '<th class="manage-column column-author" id="ticket" scope="col" style="width:10%;">' . __('Ticket', 'event_espresso') . '</th>' : ''; ?> </tr> </thead> <tbody> <?php $wpdb->get_results("SELECT id FROM " . EVENTS_MEMBER_REL_TABLE . " WHERE user_id = '" . $current_user->ID . "'"); if ($wpdb->num_rows > 0) { $events = $wpdb->get_results("SELECT e.id event_id, e.event_name, e.event_code, e.start_date, e.event_desc, e.display_desc, a.id attendee_id, a.event_time start_time, a.payment_status, a.payment_date, a.amount_pd, u.user_id user_id, a.registration_id, a.fname, a.lname, a.price_option, a.event_time\n\t\t\t\t\t\t\t\t\t\t\t\t\tFROM " . EVENTS_ATTENDEE_TABLE . " a\n\t\t\t\t\t\t\t\t\t\t\t\t\tJOIN " . EVENTS_MEMBER_REL_TABLE . " u ON u.attendee_id = a.id\n\t\t\t\t\t\t\t\t\t\t\t\t\tJOIN " . EVENTS_DETAIL_TABLE . " e ON e.id = u.event_id\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE u.user_id = '" . $current_user->ID . "'"); foreach ($events as $event) { $event_id = $event->event_id; $event_code = $event->event_code; $attendee_id = $event->attendee_id; $registration_id = $event->registration_id; $lname = $event->lname; $fname = $event->fname; $event_name = $event->event_name; $start_date = $event->start_date; $start_time = $event->start_time; $event_desc = $event->event_desc; $display_desc = $event->display_desc; $payment_status = $event->payment_status; $amount_pd = espresso_attendee_price(array('attendee_id' => $attendee_id)); $payment_date = $event->payment_date; $ticket_type = $event->price_option; if ($payment_status == '') { $payment_link = get_option('siteurl') . "/?page_id=" . $org_options['return_url'] . "&id=" . $attendee_id; $payment_status = '<a href="' . $payment_link . '">Pay Now</a>'; } $event_url = home_url() . "/?page_id=" . $org_options['event_page_id'] . "®event_action=register&event_id=" . $event_id; $event_link = '<a class="row-title" href="' . $event_url . '">' . stripslashes_deep($event->event_name) . '</a>'; //Build the payment link $payment_url = home_url() . "/?page_id=" . $org_options['return_url'] . "&registration_id=" . $registration_id; //$payment_link = '<a href="' . $payment_url . '" title="'.__('View Your Payment Details').'">' . event_espresso_paid_status_icon( $payment_status ) . '</a>'; //Deprecated ticketing system support //If the custom ticket is available, load the template file if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . "/ticketing/template.php")) { if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . "/ticketing/functions.php")) { include_once EVENT_ESPRESSO_UPLOAD_DIR . "/ticketing/functions.php"; $qr_code = espresso_qr_code(array('attendee_id' => $attendee_id, 'event_name' => stripslashes_deep($event_name), 'attendee_first' => $fname, 'attendee_last' => $lname, 'registration_id' => $registration_id, 'event_code' => $event_code, 'ticket_type' => $ticket_type, 'event_time' => $event_time, 'amount_pd' => $amount_pd)); } //Build the ticket link $ticket_url = home_url() . "/?download_ticket=true&id=" . $attendee_id . "&registration_id=" . $registration_id; $ticket_link = '<a href="' . $ticket_url . '">' . __('Download Ticket Now!') . '</a>'; } //New ticketing system suport if (function_exists('espresso_ticket_launch')) { $ticket_link = espresso_ticket_links($registration_id, $attendee_id); } ?> <tr> <td><input name="checkbox[<?php echo $attendee_id; ?> ]" type="checkbox" title="Cancel registration for <?php echo $event_name; ?> "></td> <td class="post-title page-title column-title"><strong><?php echo $event_link; ?> </strong> </td> <td class="post-title page-title column-title"><?php echo $ticket_type; ?> </td> <td class="date column-date"><?php echo event_date_display($start_date); ?> </td> <td class="date column-date"><?php echo $start_time; ?> </td> <td class="date column-date"><?php echo '<a target="_blank" href="' . $payment_url . '" title="' . __('View Your Payment Details') . '">'; event_espresso_paid_status_icon($payment_status) . '</a>'; ?> </td> <td class="date column-date"><?php echo $org_options['currency_symbol']; echo $amount_pd; ?> </td> <td class="date column-date"><a href="<?php echo home_url(); ?> /?download_invoice=true&admin=true&registration_id=<?php echo $registration_id; ?> " target="_blank" title="<?php _e('Download Invoice', 'event_espresso'); ?> "><img src="<?php echo EVENT_ESPRESSO_PLUGINFULLURL; ?> images/icons/page_white_acrobat.png" width="16" height="16" alt="<?php _e('Download Invoice', 'event_espresso'); ?> " /></a></td> <?php echo $ticketing_installed == true ? '<td class="post-title page-title column-title">' . $ticket_link . '</td>' : ''; ?> </tr> <?php } } ?> </tbody> </table> <div class="bottom_settings" style="clear:both; margin-bottom:30px;"> <input type="checkbox" name="sAll" onclick="selectAll(this)" /> <strong><?php _e('Check All', 'event_espresso'); ?> </strong> <input name="cancel_registration" type="submit" class="button-secondary" id="cancel_registration" value="<?php _e('Cancel Registration', 'event_espresso'); ?> " onclick="return confirmDelete();"> <a style="margin-left:20px" class="button-primary" onclick="window.location='<?php echo admin_url(); ?> profile.php#event_espresso_profile'"><?php _e('Your Profile', 'event_espresso'); ?> </a> </div> </form> </div> </div> </div> <script> jQuery(document).ready(function($) { /* show the table data */ var mytable = $('#table').dataTable( { "bStateSave": true, "sPaginationType": "full_numbers", "oLanguage": { "sSearch": "<strong><?php _e('Live Search Filter', 'event_espresso'); ?> :</strong>", "sZeroRecords": "<?php _e('No Records Found!', 'event_espresso'); ?> " }, "aoColumns": [ { "bSortable": false }, null, null, null, null, null, null, { "bSortable": false }, <?php echo $ticketing_installed == true ? '{ "bSortable": false }' : ''; ?> ] } ); } ); </script> <?php }