Support

Home Forums Event Espresso Premium Display Price in Confirmation Admin Email

Display Price in Confirmation Admin Email

Posted: August 20, 2012 at 11:40 am


Candi Stroh

August 20, 2012 at 11:40 am

I have searched the forums, but haven’t been able to find a solution to show the price that my attendee(s) paid or how they paid in the registration confirmation email that is sent to the admin (me). I read that you can add that info in the functions/email.php section and I have done that, but it still isn’t showing up on the email confirmation. Please advise, I was hoping to take this live soon.


Garth

  • Support Staff

August 20, 2012 at 2:34 pm

https://eventespresso.com/wiki/email-manager/ take a look at the email shortcodes. [cost] will display the cost of the registration.

I’m not sure how to display the “how” they paid. Do you mean the method (e.g. invoice, bank transfer, PayPal, etc.)?


Candi Stroh

August 20, 2012 at 3:20 pm

Yes sorry payment method. I have the “Cost” showing in the email confirmation that the attendee gets, just not in the admin email that my registrar gets.


Josh

  • Support Staff

August 20, 2012 at 7:27 pm

Make sure that you make the changes to the espresso_prepare_admin_email function. /includes/functions/email.php has several functions that apply to different emails. If you’d like someone to make these customizations for you, you might try posting an ad on the job board or purchase a support token.


Candi Stroh

August 21, 2012 at 10:09 am

I would just like someone to tell where to add this one piece of code to add the total amount paid and payment method to the email.php page. I don’t understand why it has to be so complicated. I’m sorry but I am going to have to search the forums some more for an answer, I don’t have the resources to for someone to customize this. I see everywhere where to remove the cost/ event price, but no where to add it. That just seems strange to me. Thank you!


Chris Reynolds

  • Support Staff

August 21, 2012 at 3:16 pm

@Candi —

There are a bunch of emails that get handled in the /functions/email.php file. It’s possible that the one you added the cost to was the wrong one or that you’re calling a variable that hasn’t been defined in that function. Can you post your code and where you put it in your email.php? Also, we don’t recommend modifying the core Event Espresso files unless you are using the custom files add-on because your modifications will be lost when you upgrade.


Candi Stroh

August 22, 2012 at 10:11 am

Trust me I don’t like making changes to the core files either, so I have downloaded the custom files and will upload that after i receive info back from you.
`get_results( $sql );
if ( NULL !== $rs && count( $rs ) > 0 ) {
$result = true;
} elseif ( ‘espresso_group_admin’ == espresso_member_data( ‘role’ ) &&
( isset( $espresso_manager[ ‘event_manager_venue’ ] ) && “y” == strtolower( $espresso_manager[ ‘event_manager_venue’ ] ) )
) {
$group = get_user_meta( espresso_member_data( ‘id’ ), “espresso_group”, true );
$group = unserialize( $group );
if (is_array( $group ) && count( $group ) > 0 ) {
$sql = ” SELECT * FROM ” . EVENTS_VENUE_TABLE . ” v LEFT JOIN ” . EVENTS_LOCALE_REL_TABLE . ” lr ON v.id = lr.venue_id WHERE v.id = ‘” . $venue_id . “‘ AND lr.locale_id IN (” . implode( ‘,’, $group ) . “) “;
$rs = $wpdb->get_results( $sql );
if ( NULL !== $rs && count( $rs ) > 0 ) $result = true;
}
}
}

    return $result;
}

}

if ( !function_exists( ‘espresso_venue_dd’ ) ){
function espresso_venue_dd($current_value=0){
global $espresso_premium; if ($espresso_premium != true) return;
global $wpdb, $espresso_manager, $current_user;

    $WHERE = " WHERE ";
    $sql = "SELECT ev.*, el.name AS locale FROM " . EVENTS_VENUE_TABLE . " ev ";
    $sql .= " LEFT JOIN " . EVENTS_LOCALE_REL_TABLE . " lr ON lr.venue_id = ev.id ";
    $sql .= " LEFT JOIN " . EVENTS_LOCALE_TABLE . " el ON el.id = lr.locale_id ";

    if(  function_exists('espresso_member_data') && ( espresso_member_data('role')=='espresso_group_admin' ) ){
        if( $espresso_manager['event_manager_venue'] == "Y" ){
            //show only venues inside their assigned locales.
            $group = get_user_meta(espresso_member_data('id'), "espresso_group", true);
            $group = unserialize($group);
            $sql .= " $WHERE lr.locale_id IN (" . implode(",", $group) . ")";
            $sql .= " OR ev.wp_user = ".$current_user->ID ;
            $WHERE = " AND ";
        }
    }
    $sql .= " GROUP BY ev.id ORDER by name";

    //echo $sql;
    $venues = $wpdb->get_results($sql);
    $num_rows = $wpdb->num_rows;

return “

".print_r( $venues,true )."

“;
/*
[id] => 3
[name] => Home
[identifier] =>
[address] => 101-1414 Government Street
[address2] =>
[city] => Penticton
[state] => BC
[zip] => V2A 4W1
[country] => Canada
[meta] => a:6:{s:7:”contact”;s:0:””;s:5:”phone”;s:0:””;s:7:”twitter”;s:0:””;s:5:”image”;s:0:””;s:7:”website”;s:0:””;s:11:”description”;s:0:””;}
[locale] =>
[wp_user] => 0
*/
//echo $current_value;
if ($num_rows > 0) {
$field = ” . (‘Select from Venue Manager list’, ‘event_espresso’) . ”;
$field .= ‘\n’;
$field .= ”.
(‘Select a Venue’, ‘event_espresso’).”;
$div = “”;
$help_div = “”;
$i = 0;
foreach ($venues as $venue){

            $i++;
            $selected = $venue->id == $current_value ? 'selected="selected"' : '';
            if ($venue->locale != '') {
                $field .= 'id .'">' . stripslashes_deep($venue->name) . ' (' . stripslashes_deep($venue->locale) . ') \n';
            } else if ($venue->city != '' && $venue->state != '') {
                $field .= 'id .'">' . stripslashes_deep($venue->name) . ' (' . stripslashes_deep($venue->city). ', ' . stripslashes_deep($venue->state) . ') \n';
            } else if ($venue->state != '') {
                $field .= 'id .'">' . stripslashes_deep($venue->name) . ' (' . stripslashes_deep($venue->state) . ') \n';
            } else {
                $field .= 'id .'">' . stripslashes_deep($venue->name) . ' \n';
            }

            $hidden = "display:none;";
            if( $selected ) $hidden = '';
            $div .= "";
            $div .= "Address: ".stripslashes_deep($venue->address)."";
            $div .= "Address 2: ".stripslashes_deep($venue->address2)."";
            $div .= "City: ".stripslashes_deep($venue->city)."";
            $div .= "State: ".stripslashes_deep($venue->state)."";
            $div .= "Zip: ".stripslashes_deep($venue->zip)."";
            $div .= "Country: ".stripslashes_deep($venue->country)."";
            $div .= "Venue ID: ".$venue->id."";
            $div .= '<a>id.'" target="_blank"&gt;'.__('Edit this venue', 'event_espresso').'</a> | <a href="#TB_inline?height=300&amp;width=400&amp;inlineId=venue_info">Shortcode</a>';
            $div .= "";
        }
        $field .= "";
        $help_div .= '';
        $help_div .= ''.__('Venue Shortcode', 'event_espresso').'';
        $help_div .= ''.__('Add the following shortcode into the description to show the venue for this event.', 'event_espresso').'';
        $help_div .= '[ESPRESSO_VENUE]';
        $help_div .= ''.__('To use this venue in a page or post. Use the following shortcode.', 'event_espresso').'';
        $help_div .= '[ESPRESSO_VENUE id="selected_venue_id"]';
        $help_div .= 'Example with Optional Parameters:[ESPRESSO_VENUE outside_wrapper="div" outside_wrapper_class="event_venue"]';
        $help_div .= '<strong><a href="https://eventespresso.com/forums/2010/10/post-type-variables-and-shortcodes/#venue_shortcode">More Examples</a></strong>';
        $help_div .= '';
        ob_start();

?>

                jQuery("#venue_id").change( function(){
                    var selected = jQuery("#venue_id option:selected");
                    var rel = selected.attr("rel");
                    jQuery(".eebox").hide();
                    jQuery("#eebox_"+rel).show();
                });

<?php
$js = ob_get_contents();
ob_end_clean();
$html = '’ . $field .”.$div.”.$help_div.$js;
return $html;
}
}
}

if ( !function_exists( ‘espresso_personnel_cb’ ) ){
function espresso_personnel_cb($event_id = 0){
global $espresso_premium; if ($espresso_premium != true) return;
global $wpdb;
$sql = “SELECT id, name, role, meta FROM ” . EVENTS_PERSONNEL_TABLE;
if (function_exists(‘espresso_member_data’) ) {
$wpdb->get_results(“SELECT wp_user FROM ” . EVENTS_DETAIL_TABLE . ” WHERE id = ‘” . $event_id . “‘”);
$wp_user = $wpdb->last_result[0]->wp_user !=” ? $wpdb->last_result[0]->wp_user:espresso_member_data(‘id’);
$sql .= ” WHERE “;
if ($wp_user == 0 || $wp_user == 1){
$sql .= ” (wp_user = ‘0’ OR wp_user = ‘1’) “;
}else{
$sql .= ” wp_user = ‘” . $wp_user .”‘ “;
}
}
$event_personnel = $wpdb->get_results($sql);
$num_rows = $wpdb->num_rows;
if ($num_rows > 0){
$html= ”;
foreach ($event_personnel as $person){
$person_id = $person->id;
$person_name = $person->name;
$person_role = $person->role;

            $meta = unserialize($person-&gt;meta);
            $person_organization = (isset($meta['organization']) &amp;&amp; $meta['organization'] !='') ? $meta['organization'] :'';
            //$person_title = $meta['title']!=''? $meta['title']:'';
            $person_info = (isset($person_role) &amp;&amp; $person_role !='') ?' ['. $person_role . ']':'';

            $in_event_personnel = $wpdb-&gt;get_results("SELECT * FROM " . EVENTS_PERSONNEL_REL_TABLE . " WHERE event_id='".$event_id."' AND person_id='".$person_id."'");
            $in_event_person = '';
            foreach ($in_event_personnel as $in_person){
                $in_event_person = $in_person-&gt;person_id;
            }

            $html .= ' <a href="admin.php?page=event_staff&amp;action=edit&amp;id='.$person_id.'" title="'.$person_organization.'">' . $person_name .'</a> '. $person_info.'';

        }

        $top_div ='';
        $bottom_div ='';

        if ($num_rows &gt; 10){
            $top_div = '';
            $bottom_div = '';
        }

        $manage = '<a href="admin.php?page=event_staff">'.__('Manage Staff Members', 'event_espresso').'</a> | <a href="#TB_inline?height=300&amp;width=400&amp;inlineId=staff_info">Shortcode</a> ';

        echo '';
        echo ''.__('Staff Shortcode', 'event_espresso').'';
        echo ''.__('Add the following shortcode into the description to show the staff for this event.', 'event_espresso').'';
        echo '[ESPRESSO_STAFF]';
        echo 'Example with Optional Parameters:
        [ESPRESSO_STAFF outside_wrapper="div" outside_wrapper_class="event_staff" inside_wrapper="p" inside_wrapper_class="event_person"]';

        echo '<strong><a href="https://eventespresso.com/forums/2010/10/post-type-variables-and-shortcodes/#staff_shortcode">More Examples</a></strong>';
        echo '';

        $html = $top_div.$html.$bottom_div.$manage;
        return $html;

    }else{
        return '<a href="admin.php?page=event_staff&amp;action=add_new_person">'.__('Please add at least one person.', 'event_espresso').'</a>';
    }
}

}

if ( !function_exists( ‘espresso_personnel_dd’ ) ){
function espresso_personnel_dd(){
global $espresso_premium; if ($espresso_premium != true) return;
global $wpdb;
$sql = “SELECT name, title FROM EVENTS_PERSONNEL_TABLE “;//. EVENTS_DETAIL_TABLE;
$sql .= ” WHERE name != ” GROUP BY name “;

        $people = $wpdb-&gt;get_results($sql);
        $num_rows = $wpdb-&gt;num_rows;
        //return print_r( $events );
        if ($num_rows &gt; 0) {
            $field = '\n';
            $field .= ''.__('Select a Person', 'event_espresso').'';

            foreach ($people as $person){
                $selected = $event-&gt;name == $current_value ? 'selected="selected"' : '';
                $meta = unserialize($person-&gt;meta);
                $title = $meta['title']!=''? ' (' . $meta['title'] . ')':'';
                $field .= 'id .'"&gt;' . $person-&gt;name .  $title . '\n';
            }
            $field .= "";
            $html = '' .__('Primary','event_espresso') . ': ' . $field .'';
            return $html;
        }
}

}
if (!function_exists(‘espresso_chart_display’)){
function espresso_chart_display($event_id, $type){
global $wpdb, $org_options;
$retVAl = array();
switch ($type){
case ‘total_reg’:
//Total Registrations/Transactions
$title = __(‘Total Registrations/Transactions’, ‘event_espresso’);
$sql = “SELECT SUM(a.amount_pd) amount, SUM(a.quantity) quantity, DATE_FORMAT(a.date,’%b %d’) date FROM “.EVENTS_ATTENDEE_TABLE.” a WHERE event_id =”.$event_id.” GROUP BY DATE_FORMAT(a.date,’%m-%d-%Y’)”;
break;

        case 'total_completed':
            //Completed Registrations/Transactions
            $title = __('Completed Registrations/Transactions', 'event_espresso');
            $sql = "SELECT SUM(a.amount_pd) amount, SUM(a.quantity) quantity, DATE_FORMAT(a.date,'%b %d') date FROM ".EVENTS_ATTENDEE_TABLE." a WHERE event_id =".$event_id." AND payment_status='Completed' GROUP BY DATE_FORMAT(a.date,'%m-%d-%Y')";
        break;

        case 'total_pending':
            //Pending Registrations/Transactions
            $title = __('Pending Registrations/Transactions', 'event_espresso');
            $sql = "SELECT SUM(a.amount_pd) amount, SUM(a.quantity) quantity, DATE_FORMAT(a.date,'%b %d') date FROM ".EVENTS_ATTENDEE_TABLE." a WHERE event_id =".$event_id." AND payment_status='Pending' GROUP BY DATE_FORMAT(a.date,'%m-%d-%Y')";
        break;

        case 'total_incomplete':
            //Incomplete Registrations/Transactions
            $title = __('Incomplete Registrations/Transactions', 'event_espresso');
            $sql = "SELECT SUM(a.amount_pd) amount, SUM(a.quantity) quantity, DATE_FORMAT(a.date,'%b %d') date FROM ".EVENTS_ATTENDEE_TABLE." a WHERE event_id =".$event_id." AND (payment_status='Incomplete' OR payment_status='Payment Declined') GROUP BY DATE_FORMAT(a.date,'%m-%d-%Y')";
        break;
    }

    $results = $wpdb-&gt;get_results($sql);
    if ($wpdb-&gt;num_rows &gt; 0) {

    foreach ($results as $row) {
        $retVal[] = $row;
    }

    $attendees = '';
    $amount ='';
    $date = '';
    foreach($retVal as $rec ){
        $amount .= $rec-&gt;amount.',';
        $date .= "'".$rec-&gt;date."', ";
        $attendees .= $rec-&gt;quantity.", ";
    }
 //echo "<pre>".print_r($retVal,true)."</pre>";
  ?&gt;

     jQuery(document).ready(function() {
            var line1 = [];//bottom column
            var line2 = [];
            var ticks = [];

            plot1 = jQuery.jqplot('', [line1, line2], {
                //stackSeries: true,
                title: '',
                seriesDefaults:{
                    renderer:jQuery.jqplot.BarRenderer,
                    pointLabels: { show: true },
                },
                axes: {
                    xaxis: {
                        renderer: jQuery.jqplot.CategoryAxisRenderer,
                        ticks: ticks
                    }
                },
                series: [{
                    label: '# Attendees'
                },
                {
                    label: ' ',
                    pointLabels: { formatString:'%.2f' },
                }],
                legend: {
                    show: true,
                    location: 'ne',     // compass direction, nw, n, ne, e, se, s, sw, w.
                    placement: 'outsideGrid'

                },

            });

        });

       &lt;!--  --&gt;
    &lt;div id=&quot;" style="margin-top:20px; margin-left:20px; width:600px; height:200px; float:left;"&gt;
    "","event_format"=&gt;"","event_livestreamed"=&gt;"");
}

}

if (!function_exists(‘event_espresso_meta_edit’)){
function event_espresso_meta_edit($event_meta=”) {
global $wpdb, $org_options;
global $espresso_premium;
if ($espresso_premium != true)
return;
$good_meta = array();
$hiddenmeta = array(“”, “venue_id”, “additional_attendee_reg_info”, “add_attendee_question_groups”, “date_submitted”, “event_host_terms”, “default_payment_status”,”event_thumbnail_url”);
$meta_counter = 1;

    $default_meta = $event_meta==''?ee_default_event_meta():array();
    $event_meta = $event_meta==''?array():$event_meta;
    $event_meta = array_merge($event_meta, $default_meta);
    //print_r( $event_meta );
    $good_meta = $event_meta;
    //print_r( $good_meta );
    ?&gt;

<img src="images/question-frame.png” width=”16″ height=”16″ />

         $v) {
                ?&gt;
                &lt;?php
                if (in_array($k, $hiddenmeta)) {
                    //              echo &quot;";
                    unset($good_meta[$k]);
                } else {
                    ?&gt;


                 $v2) { ?&gt;
                                &lt;option value=&quot;" &gt;


                         &lt;input  size=&quot;20&quot; type=&quot;text&quot; value=&quot;" name="emetad[]" id="emetad[]" /&gt;
                    &lt;?php
                    echo &#039;';
                    ?&gt;


            &lt;?php }
            echo &#039;' . __('Key: ', 'event_espresso'); ?&gt;  &lt;?php
        echo &#039; ' . '';
    } else {
        echo '' . __('Key: ', 'event_espresso');
        ?&gt;  &lt;?php
        echo &#039; &nbsp;' . '';
        // $meta_counter++;
    }
    ?&gt;


    &lt;input type=&quot;button&quot; class=&quot;button&quot; value=&quot;" onClick="addMetaInput('dynamicMetaInput');"&gt;


        //Dynamic form fields
        var meta_counter =  1 ? $meta_counter - 1 : $meta_counter++; ?&gt;;
        function addMetaInput(divName){
            var next_counter = counter_staticm(meta_counter);
            var newdiv = document.createElement('li');
            newdiv.innerHTML = "&lt;?php echo &#039; '; ?&gt;";
            document.getElementById(divName).appendChild(newdiv);
            counter++;
        }

        function counter_staticm(meta_counter) {
            if ( typeof counter_static.counter == 'undefined' ) {

                counter_static.counter = meta_counter;
            }
            return ++counter_static.counter;
        }

    &lt;?php
}

}`


Candi Stroh

August 22, 2012 at 10:13 am

Wait, sorry I posted the wrong code: I posted the functions.php, just ignore the above.

attendee-&gt;event_id,
        $data-&gt;event-&gt;event_identifier,
        $data-&gt;attendee-&gt;registration_id,
        $data-&gt;attendee-&gt;fname,
        $data-&gt;attendee-&gt;lname,
        $data-&gt;event-&gt;venue_phone,
        $data-&gt;event-&gt;event_name,
        $data-&gt;event-&gt;event_name,
        $data-&gt;event-&gt;event_desc,
        $data-&gt;event_link,
        $data-&gt;event_url,
        $data-&gt;event-&gt;virtual_url,
        $data-&gt;event-&gt;virtual_phone,
        //Venue information
        $data-&gt;event-&gt;venue_name,
        $data-&gt;event-&gt;venue_url,
        $data-&gt;event-&gt;venue_image,
        $data-&gt;event-&gt;venue_phone,
        $data-&gt;location, //For the "[venue_address]" shortcode shows the venue address
        //Payment details
        $data-&gt;attendee-&gt;txn_id,
        $org_options['currency_symbol'] . espresso_attendee_price(array('registration_id' =&gt; $data-&gt;attendee-&gt;registration_id, 'session_total' =&gt; true)),
        $org_options['currency_symbol'] . espresso_attendee_price(array('registration_id' =&gt; $data-&gt;attendee-&gt;registration_id, 'session_total' =&gt; true)),
        $data-&gt;attendee-&gt;event_price,
        $data-&gt;ticket_link,
        empty($data-&gt;certificate_link) ? '' : $data-&gt;certificate_link,
        $data-&gt;event-&gt;alt_email == '' ? $org_options['contact_email'] : $data-&gt;event-&gt;alt_email,
        //Organization details
        $org_options['organization'],
        $org_options['organization_street1'],
        $org_options['organization_street2'],
        $org_options['organization_city'],
        $org_options['organization_state'],
        $org_options['organization_zip'],
        $data-&gt;payment_link,
        $data-&gt;invoice_link,
        event_date_display($data-&gt;attendee-&gt;start_date),
        event_date_display($data-&gt;attendee-&gt;event_time, get_option('time_format')),
        event_date_display($data-&gt;attendee-&gt;end_date),
        event_date_display($data-&gt;attendee-&gt;end_time, get_option('time_format')),
        $data-&gt;location,
        $data-&gt;event-&gt;venue_phone,
        $data-&gt;google_map_link,
        $data-&gt;table_open . $data-&gt;table_heading . $data-&gt;event_table . $data-&gt;table_close,
        $data-&gt;email_questions,
        $data-&gt;qr_code,
        $data-&gt;edit_attendee,
        apply_filters('filter_hook_espresso_display_add_to_calendar_by_attendee_id', $data-&gt;attendee-&gt;id)
);

//Get the questions and answers
$questions = $wpdb-&gt;get_results("select qst.question as question, ans.answer as answer from " . EVENTS_ANSWER_TABLE . " ans inner join " . EVENTS_QUESTION_TABLE . " qst on ans.question_id = qst.id where ans.attendee_id = " . $data-&gt;attendee-&gt;id, ARRAY_A);
//echo ''.print_r($questions).'';
if ($wpdb-&gt;num_rows &gt; 0 &amp;&amp; $wpdb-&gt;last_result[0]-&gt;question != NULL) {
    foreach ($questions as $q) {
        $k = $q['question'];
        $v = $q['answer'];

        //Output the question
        array_push($SearchValues, "[" . 'question_' . $k . "]");
        array_push($ReplaceValues, $k);

        //Output the answer
        array_push($SearchValues, "[" . 'answer_' . $k . "]");
        array_push($ReplaceValues, $v);
    }
}
//Get the event meta
//echo ''.print_r($data-&gt;event-&gt;event_meta).'';
if (!empty($data-&gt;event-&gt;event_meta)) {
    foreach ($data-&gt;event-&gt;event_meta as $k =&gt; $v) {
        if (!empty($k) &amp;&amp; !is_array($v)) {
            array_push($SearchValues, "[" . $k . "]");
            array_push($ReplaceValues, stripslashes_deep($v));
        }
    }
}
//Perform the replacement
return str_replace($SearchValues, $ReplaceValues, $message);

}

//Build the email
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;
$data->seatingchart_tag = ”;
//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 = '';
}
$data-&gt;email_type = $custom_data_email_type;
$sql = "SELECT ed.* ";
isset($org_options['use_venue_manager']) &amp;&amp; $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']) &amp;&amp; $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-&gt;event = $wpdb-&gt;get_row($sql, OBJECT);

//Get the attendee record
$sql = "SELECT ea.* FROM " . EVENTS_ATTENDEE_TABLE . " ea WHERE ea.id = '" . $attendee_id . "' ";
$data-&gt;attendee = $wpdb-&gt;get_row($sql, OBJECT);

//Get the primary/first attendee
$data-&gt;primary_attendee = espresso_is_primary_attendee($data-&gt;attendee-&gt;id) == true ? true : false;

$data-&gt;event-&gt;event_meta = unserialize($data-&gt;event-&gt;event_meta);

//Venue variables
if (isset($org_options['use_venue_manager']) &amp;&amp; $org_options['use_venue_manager'] == 'Y') {
    $data-&gt;event-&gt;venue_meta = unserialize($data-&gt;event-&gt;venue_meta);

    //Debug
    //echo "<pre>".print_r($data-&gt;event-&gt;venue_meta,true)."</pre>";

    $data-&gt;event-&gt;venue_url = $data-&gt;event-&gt;venue_meta['website'];
    $data-&gt;event-&gt;venue_phone = $data-&gt;event-&gt;venue_meta['phone'];
    $data-&gt;event-&gt;venue_image = 'event-&gt;venue_meta['image'].'" /&gt;';
    $data-&gt;event-&gt;venue_name = $data-&gt;event-&gt;venue_name;
    $data-&gt;event-&gt;address = $data-&gt;event-&gt;venue_address;
    $data-&gt;event-&gt;address2 = $data-&gt;event-&gt;venue_address2;
    $data-&gt;event-&gt;city = $data-&gt;event-&gt;venue_city;
    $data-&gt;event-&gt;state = $data-&gt;event-&gt;venue_state;
    $data-&gt;event-&gt;zip = $data-&gt;event-&gt;venue_zip;
    $data-&gt;event-&gt;country = $data-&gt;event-&gt;venue_country;
} else {
    $data-&gt;event-&gt;venue_name = $data-&gt;event-&gt;venue_title;

}
//Build the table to hold the event and attendee info
$data-&gt;table_open = '';
$data-&gt;table_heading = "" . __('Event Name', 'event_espresso') . "" . __('Date', 'event_espresso') . "" . __('Time', 'event_espresso') . "" . __('Location', 'event_espresso') . "" . __('Event_Price', 'event_espresso') . "";
$data-&gt;table_close = "";

//Clear ticket data
$data-&gt;qr_code = '';
$data-&gt;ticket_link = '';
$data-&gt;admin_ticket_link = '';

if (defined("ESPRESSO_SEATING_CHART")) {
    if (class_exists("seating_chart")) {
        if ( seating_chart::check_event_has_seating_chart($data-&gt;event-&gt;id)) {
            $rs = $wpdb-&gt;get_row("select scs.* from ".EVENTS_SEATING_CHART_EVENT_SEAT_TABLE." sces inner join ".EVENTS_SEATING_CHART_SEAT_TABLE." scs on sces.seat_id = scs.id where sces.attendee_id = ".$attendee_id);
            if ( $rs !== NULL ) {
                $data-&gt;seatingchart_tag = $rs-&gt;custom_tag." ".$rs-&gt;seat." ".$rs-&gt;row;
            }
        }
    }
}

//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-&gt;qr_code = espresso_qr_code( array('attendee_id' =&gt; $data-&gt;attendee-&gt;id, 'registration_id' =&gt; $data-&gt;attendee-&gt;registration_id, 'event_code' =&gt; $data-&gt;event-&gt;event_code ));
    }
    $data-&gt;ticket_link = espresso_ticket_links($data-&gt;attendee-&gt;registration_id, $data-&gt;attendee-&gt;id);
    $data-&gt;admin_ticket_link = $data-&gt;ticket_link;
}

//New ticketing system version 2.0
if (function_exists('espresso_ticket_launch')) {
    $data-&gt;qr_code = espresso_ticket_qr_code( array('attendee_id' =&gt; $data-&gt;attendee-&gt;id, 'registration_id' =&gt; $data-&gt;attendee-&gt;registration_id, 'event_code' =&gt; $data-&gt;event-&gt;event_code ));
    $data-&gt;ticket_link = espresso_ticket_links($data-&gt;attendee-&gt;registration_id, $data-&gt;attendee-&gt;id);
    $data-&gt;admin_ticket_link = $data-&gt;ticket_link;
}

//certificate system
if (function_exists('espresso_certificate_launch')) {
    $data-&gt;certificate_link = espresso_certificate_links($data-&gt;attendee-&gt;registration_id, $data-&gt;attendee-&gt;id);
    $data-&gt;admin_certificate_link = $data-&gt;certificate_link;
}


//Build the address
$data-&gt;location = ($data-&gt;event-&gt;address != '' ? $data-&gt;event-&gt;address : '') . ($data-&gt;event-&gt;address2 != '' ? '' . $data-&gt;event-&gt;address2 : '') . ($data-&gt;event-&gt;city != '' ? '' . $data-&gt;event-&gt;city : '') . ($data-&gt;event-&gt;state != '' ? ', ' . $data-&gt;event-&gt;state : '') . ($data-&gt;event-&gt;zip != '' ? '' . $data-&gt;event-&gt;zip : '') . ($data-&gt;event-&gt;country != '' ? '' . $data-&gt;event-&gt;country : '');

//Build Google map link
$data-&gt;google_map_link = espresso_google_map_link(array('address' =&gt; $data-&gt;event-&gt;address, 'city' =&gt; $data-&gt;event-&gt;city, 'state' =&gt; $data-&gt;event-&gt;state, 'zip' =&gt; $data-&gt;event-&gt;zip, 'country' =&gt; $data-&gt;event-&gt;country));

//Registration URL
$data-&gt;event_url = espresso_reg_url($data-&gt;event-&gt;id);
$data-&gt;event_link = '<a>event_url . '"&gt;' . stripslashes_deep($data-&gt;event-&gt;event_name) . '</a>';

//Venue name
if (!isset($data-&gt;event-&gt;venue_name))
    $data-&gt;event-&gt;venue_name = '';

//Table of events registered for

/* $data->event_table .= “

        " . stripslashes_deep($data-&gt;event-&gt;event_name) . " | " . $data-&gt;attendee-&gt;price_option . "
        " . event_date_display($data-&gt;attendee-&gt;start_date) . ' - ' . event_date_display($data-&gt;attendee-&gt;end_date) . "
        " . event_date_display($data-&gt;attendee-&gt;event_time, get_option('time_format')) . " - " . event_date_display($data-&gt;attendee-&gt;end_time, get_option('time_format')) . "
        " . $data-&gt;event-&gt;venue_name . "$data-&gt;location $data-&gt;google_map_link" .
                ($data-&gt;attendee-&gt;quantity &gt; 0 ? '' . $data-&gt;attendee-&gt;quantity . __(' attendees', 'event_espresso') . '' : '') .
                "";*/

$data-&gt;event_table .= espresso_generate_attendee_event_list( $data );

//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' =&gt; $data-&gt;attendee-&gt;id, 'all_questions' =&gt; TRUE));
    if ($email_questions_r != '')
        $data-&gt;email_questions = '' . $email_questions_r . '';
    $data-&gt;event_table .= $data-&gt;email_questions;
}

//Payment URL
$payment_url = get_option('siteurl') . "/?page_id=" . $org_options['return_url'] . "&amp;r_id=" . $data-&gt;attendee-&gt;registration_id;
$data-&gt;payment_link = '<a href="' . $payment_url . '">' . __('View Your Payment Details','event_espresso') . '</a>';

// download link
$data-&gt;invoice_link = '<a>attendee-&gt;id . '&amp;r_id=' . $data-&gt;attendee-&gt;registration_id . '" target="_blank"&gt;' . __('Download PDF Invoice', 'event_espresso') . '</a>';


//Edit attendee link
$data-&gt;edit_attendee = espresso_edit_attendee($data-&gt;attendee-&gt;registration_id, $data-&gt;attendee-&gt;id, $data-&gt;attendee-&gt;event_id, 'attendee', __('Edit Registration Details','event_espresso'));

$data-&gt;email_subject = !$data-&gt;multi_reg ? $data-&gt;event-&gt;event_name : $org_options['organization'] . __(' registration confirmation', 'event_espresso');

//Build invoice email
if ($custom_data_email_type == 'invoice') {
    $data-&gt;email_subject = $custom_data_invoice_subject;
    $data-&gt;event-&gt;conf_mail = $custom_data_invoice_message;
    $data-&gt;event-&gt;send_mail = 'Y';
    $data-&gt;event-&gt;email_id = empty($_REQUEST['email_name']) ? '' : $_REQUEST['email_name'];
}

//Build payment email
if ($custom_data_email_type == 'payment') { 
    $data-&gt;email_subject = $custom_data_payment_subject;
    $data-&gt;event-&gt;conf_mail = $custom_data_payment_message;
    $data-&gt;event-&gt;send_mail = 'Y'; 
    $data-&gt;event-&gt;email_id = 0;
}  
//Build reminder email
if ($custom_data_email_type == 'reminder') {
    $data-&gt;email_subject = $custom_data_email_subject;
    $data-&gt;event-&gt;conf_mail = $custom_data_email_text;
    $data-&gt;event-&gt;send_mail = 'Y';
    $data-&gt;event-&gt;email_id = $custom_data_email_id &gt; 0 ? $custom_data_email_id : '';
}

return $data;

}

function espresso_generate_attendee_event_list( $data ) {

global $wpdb;

$use_venue = isset($org_options['use_venue_manager']) &amp;&amp; $org_options['use_venue_manager'] == 'Y' ? TRUE : FALSE;

$SQL = 'SELECT att.event_id, att.price_option, att.start_date, att.end_date, att.event_time, att.end_time, att.email, att.attendee_session, evt.id, evt.event_name ';   
$SQL .= $use_venue ? ', v.name venue_name ' : ', evt.venue_title venue_name ';
$SQL .= 'FROM ' . EVENTS_ATTENDEE_TABLE . ' att ';
$SQL .= 'LEFT JOIN ' . EVENTS_DETAIL_TABLE . ' evt ON evt.id=att.event_id ';    
$SQL .= $use_venue ? " LEFT JOIN " . EVENTS_VENUE_REL_TABLE . " r ON r.event_id = evt.id LEFT JOIN " . EVENTS_VENUE_TABLE . " v ON v.id = r.venue_id " : '';    
$SQL .= 'WHERE att.email = %s AND att.attendee_session = %s';

$events = $wpdb-&gt;get_results( $wpdb-&gt;prepare( $SQL, $data-&gt;attendee-&gt;email, $data-&gt;attendee-&gt;attendee_session ));

$table_row = '';
foreach ( $events as $event ) {
    $table_row .= "

        " . stripslashes_deep($event-&gt;event_name) . " | " . $event-&gt;price_option . "
        " . event_date_display($event-&gt;start_date) . ' - ' . event_date_display($event-&gt;end_date) . "
        " . event_date_display($event-&gt;event_time, get_option('time_format')) . " - " . event_date_display($event-&gt;end_time, get_option('time_format')) . "
        " . $event-&gt;venue_name . "$data-&gt;location $data-&gt;google_map_link
    ";  
}

// echo $wpdb->last_query;
// echo $wpdb->print_error();
// echo printr( $attendee, ‘$attendee’ );
// echo printr( $events, ‘$events’ );
// echo $table_row;
// die();

return $table_row;

}

//End espresso_prepare_email_data()
//Get the email ready to send
function espresso_prepare_email($data) {
global $org_options;
do_action(‘action_hook_espresso_log’, FILE, FUNCTION, ”);
//Build the subject line
$email_subject = $data->email_subject;
//Merge all the data

if ($data-&gt;event-&gt;email_id &gt; 0 &amp;&amp; $data-&gt;event-&gt;send_mail == 'Y' ) { //Get the email template if it exists 
    $email_data = array();
    $email_data = espresso_email_message($data-&gt;event-&gt;email_id);
    $conf_mail = $email_data['email_text'];
    $email_subject = $email_data['email_subject'];
} elseif ($data-&gt;event-&gt;conf_mail != '' &amp;&amp; $data-&gt;event-&gt;send_mail == 'Y') {//Else get the custom event email 
    $conf_mail = $data-&gt;event-&gt;conf_mail;
} else {//Else get the default email from the general settings 
    $conf_mail = $org_options['message'];
}

//Get the email subject
$email_subject = replace_shortcodes($email_subject, $data);

//Replace email shortcodes
$_replaced = replace_shortcodes($conf_mail, $data);

//Build the HTML
$message_top = "";
$message_bottom = "";
$email_body = $message_top . $_replaced . $message_bottom;
if (!isset($headers))
    $headers = '';
return array(
        'send_to' =&gt; $data-&gt;attendee-&gt;email,
        'email_subject' =&gt; $email_subject,
        'email_body' =&gt; $email_body,
        'headers' =&gt; $headers
);

}

//End espresso_prepare_email()
//Build the admin email
function espresso_prepare_admin_email($data) {
global $org_options;
do_action(‘action_hook_espresso_log’, FILE, FUNCTION, ”);
//Edit attendee link
$admin_attendee_link = espresso_edit_attendee($data->attendee->registration_id, $data->attendee->id, $data->attendee->event_id, ‘admin’, $data->attendee->fname . ‘ ‘ . $data->attendee->lname);

//Group registration check
if ($data-&gt;attendee-&gt;quantity &gt; 0 &amp;&amp; !$data-&gt;multi_reg)
    $primary_attendee = $data-&gt;primary_attendee == true ? "<strong>" . __('Primary Attendee', 'event_espresso') . "</strong>" : '';

//Build the email title
$admin_message = "" . __('Registration Summary:', 'event_espresso') . "";

//Email body
$attendee_quantity_count = $data-&gt;attendee-&gt;quantity;
$admin_email_body = "
    $primary_attendee $admin_attendee_link
    " . $data-&gt;attendee-&gt;email . "
    " . stripslashes_deep($data-&gt;event-&gt;event_name) . " | " . $data-&gt;attendee-&gt;event_price . "
    " . event_date_display($data-&gt;attendee-&gt;start_date) . ' - ' . event_date_display($data-&gt;attendee-&gt;end_date) . "
    " . event_date_display($data-&gt;attendee-&gt;event_time, get_option('time_format')) . " - " . event_date_display($data-&gt;attendee-&gt;end_time, get_option('time_format')) . " " .
                ($attendee_quantity_count &gt; 0 ? '' . $attendee_quantity_count . ' ' . sprintf( _n('attendee', 'attendees', $attendee_quantity_count, 'event_espresso') ) . '' : '') . "";

//Additional information/questions
$admin_additional_info = "" . __('Additional Information:', 'event_espresso') . "";

//Registration ID
if (!empty($data-&gt;attendee-&gt;registration_id)) {
    $admin_additional_info .= '<strong>' . __('Registration ID: ', 'event_espresso') . '</strong>';
    $admin_additional_info .= $data-&gt;attendee-&gt;registration_id;
}

if (!empty($data-&gt;email_questions)) {
    $admin_additional_info .= $data-&gt;email_questions;
}

//Ticket links
if (!empty($data-&gt;admin_ticket_link)) {
    $admin_additional_info .= '<strong>' . __('Ticket(s):', 'event_espresso') . '</strong>';
    $admin_additional_info .= $data-&gt;admin_ticket_link;
}

//Certificate links
if (!empty($data-&gt;admin_certificate_link)) {
    $admin_additional_info .= '<strong>' . __('Certificate(s):', 'event_espresso') . '</strong>';
    $admin_additional_info .= $data-&gt;admin_certificate_link;
}

/*//invoice links
if (!empty($data-&gt;invoice_link)) {
    $admin_additional_info .= '<strong>' . __('Invoice:', 'event_espresso') . '</strong>';
    $admin_additional_info .= $data-&gt;invoice_link;
    $admin_additional_info .= '';
}*/

//Build the headers
$headers = '';
return array(
        'send_to' =&gt; $data-&gt;event-&gt;alt_email == '' ? $org_options['contact_email'] : $data-&gt;event-&gt;alt_email . ',' . $org_options['contact_email'],
        'email_subject' =&gt; !$data-&gt;multi_reg ? $data-&gt;event-&gt;event_name . ' ' . __('registration confirmation', 'event_espresso') : __('Event Registration Notification', 'event_espresso'),
        'email_body' =&gt; $admin_message . $data-&gt;table_open . $admin_email_body . $data-&gt;table_close . $admin_additional_info,
        'headers' =&gt; $headers
);

}

//End espresso_prepare_admin_email()

function email_by_attendee_id($attendee_id, $send_attendee_email = TRUE, $send_admin_email = TRUE, $multi_reg = FALSE, $custom_data=”) {

$data = espresso_prepare_email_data($attendee_id, $multi_reg, $custom_data);


if ($send_attendee_email == 'true') {
    $email_params = espresso_prepare_email($data);  
    event_espresso_send_email($email_params);
}
if ($send_admin_email == 'true') {
    $email_params = espresso_prepare_admin_email($data);
    event_espresso_send_email($email_params);
}

}

//End email_by_attendee_id()

function email_by_session_id($session_id, $send_attendee_email = TRUE, $send_admin_email = TRUE, $multi_reg = FALSE) {
global $wpdb;
$sql = “SELECT id FROM ” . EVENTS_ATTENDEE_TABLE . ” WHERE attendee_session = %s”;
$attendees = $wpdb->get_col( $wpdb->prepare( $sql, $session_id ));
$admin_email_params = array(’email_body’=>”);
foreach ($attendees as $attendee_id) {
$data = espresso_prepare_email_data($attendee_id, $multi_reg);
if ($send_attendee_email == ‘true’) {
$attendee_email_params = espresso_prepare_email($data);
event_espresso_send_email($attendee_email_params);
}
if ($send_admin_email == ‘true’) {
$email_params = espresso_prepare_admin_email($data);
$admin_email_params[‘send_to’] = $email_params[‘send_to’];
$admin_email_params[’email_subject’] = $email_params[’email_subject’];
$admin_email_params[’email_body’] .= ”;
$admin_email_params[’email_body’] .= $email_params[’email_subject’] . ”;
$admin_email_params[’email_body’] .= ”;
$admin_email_params[’email_body’] .= $email_params[’email_body’] . ”;
$admin_email_params[‘headers’] = $email_params[‘headers’];
}
}
if ($send_admin_email == ‘true’) {
event_espresso_send_email($admin_email_params);
}
}

//End email_by_session_id()

if ( ! function_exists(‘event_espresso_email_confirmations’)) {

function event_espresso_email_confirmations($atts) {

    extract($atts);
    //print_r($atts);

    $multi_reg = empty( $multi_reg ) ? FALSE :  $multi_reg;
    $send_admin_email = empty( $send_admin_email ) ? FALSE :  $send_admin_email;
    $send_attendee_email = empty( $send_attendee_email ) ? FALSE :  $send_attendee_email;
    $custom_data = empty( $custom_data ) ? '' :  $custom_data;

    if ( ! empty( $attendee_id ) &amp;&amp; ! $multi_reg ) { 

        email_by_attendee_id($attendee_id, $send_attendee_email, $send_admin_email, $multi_reg, $custom_data);

    } elseif ( ! empty( $registration_id ) &amp;&amp; ! $multi_reg ) { 

        global $wpdb;
        $sql = "SELECT id FROM " . EVENTS_ATTENDEE_TABLE . " WHERE registration_id = %s";
        $attendees = $wpdb-&gt;get_col( $wpdb-&gt;prepare( $sql, $registration_id ));
        foreach ($attendees as $attendee_id) {
            email_by_attendee_id($attendee_id, $send_attendee_email, $send_admin_email, $multi_reg, $custom_data);
        }

    } elseif ( ! empty( $session_id )) { 

        email_by_session_id($session_id, $send_attendee_email, $send_admin_email, $multi_reg);

    }
}

}//End event_espresso_email_confirmations()
//Email sender
if (!function_exists(‘event_espresso_send_email’)) {

function event_espresso_send_email($params) {
    global $org_options;
    do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, '');
    extract($params);
    //Define email headers
    $headers = "MIME-Version: 1.0\r\n";
    if ($org_options['email_fancy_headers']=='Y') {
        $headers .= "From: " . $org_options['organization'] . " \r\n";
        $headers .= "Reply-To: " . $org_options['organization'] . "  \r\n";
    } else {
        $headers .= "From: " . $org_options['contact_email'] . "\r\n";
        $headers .= "Reply-To: " . $org_options['contact_email'] . "\r\n";
    }
    $headers .= "Content-Type: text/html; charset=utf-8\r\n";
    //Debug

// echo ”;
// echo ‘$headers = ‘.$headers.”;
// echo ‘$send_to = ‘.$send_to.”;
// echo ‘$email_subject = ‘.$email_subject.”;
// echo ‘$email_body = ‘.$email_body.”;
// echo ”.$email_body.”;
// echo ”;

    return wp_mail($send_to, stripslashes_deep(html_entity_decode($email_subject, ENT_QUOTES, "UTF-8")), stripslashes_deep(html_entity_decode(wpautop($email_body), ENT_QUOTES, "UTF-8")), $headers);
}

}//End event_espresso_send_email()
//Send Invoice
if (!function_exists(‘event_espresso_send_invoice’)) {

function event_espresso_send_invoice( $registration_id, $invoice_subject, $invoice_message, $array_of_reg_ids = FALSE ) {
    global $wpdb, $org_options;
    do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, '');

    $SQL ='SELECT a.id FROM '. EVENTS_ATTENDEE_TABLE . ' a  WHERE a.registration_id = %s';
    $result = $wpdb-&gt;get_row( $wpdb-&gt;prepare( $SQL, $registration_id ));

    $registration_id = isset($result-&gt;registration_id) &amp;&amp; !empty($result-&gt;registration_id) ? $result-&gt;registration_id : '';
    $attendee_id = $result-&gt;id;

    event_espresso_email_confirmations(array('attendee_id' =&gt; $attendee_id, 'send_admin_email' =&gt; 'false', 'send_attendee_email' =&gt; 'true', 'custom_data' =&gt; array('email_type' =&gt; 'invoice', 'invoice_subject' =&gt; $invoice_subject, 'invoice_message' =&gt; $invoice_message)));

    return;
}

}//End event_espresso_send_invoice()
//Payment Confirmations
if (!function_exists(‘event_espresso_send_payment_notification’)) {

function event_espresso_send_payment_notification($atts) {
    global $wpdb, $org_options;
    do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, '');
    //Extract the attendee_id and registration_id
    extract($atts);

    $registration_id = is_array( $registration_id ) ? $registration_id[0] : $registration_id;

    if (empty($registration_id))
        $registration_id = espresso_registration_id($attendee_id);
    if (empty($registration_id))
        return __('No ID Supplied', 'event_espresso');

    //Get the attendee  id or registration_id and create the sql statement
    $sql = "SELECT a.* FROM " . EVENTS_ATTENDEE_TABLE . " a ";
    $sql .= " WHERE a.registration_id = '" . $registration_id . "' ";
    //$sql .= "  ORDER BY id LIMIT 1 ";

    $attendees = $wpdb-&gt;get_results($sql);

    if ($org_options['default_mail'] == 'Y') { 
        foreach ($attendees as $attendee) {
            $attendee_id = $attendee-&gt;id;
            event_espresso_email_confirmations(array('attendee_id' =&gt; $attendee_id, 'send_admin_email' =&gt; 'false', 'send_attendee_email' =&gt; 'true', 'custom_data' =&gt; array('email_type' =&gt; 'payment', 'payment_subject' =&gt; $org_options['payment_subject'], 'payment_message' =&gt; $org_options['payment_message'])));
        }
    }

    return;
}

}

//Reminder Notices
if (!function_exists(‘espresso_event_reminder’)) {

function espresso_event_reminder($event_id, $email_subject='', $email_text='', $email_id=0) {
    global $wpdb, $org_options;
    do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, '');
    $count = 0;
    $SQL = 'SELECT * FROM ' . EVENTS_ATTENDEE_TABLE . ' WHERE event_id =%d GROUP BY lname, fname';

    $attendees = $wpdb-&gt;get_results( $wpdb-&gt;prepare( $SQL, $event_id ));

    if ($wpdb-&gt;num_rows &gt; 0) {
        foreach ($attendees as $attendee) {
            $attendee_id = $attendee-&gt;id;
            event_espresso_email_confirmations(array('attendee_id' =&gt; $attendee_id, 'send_admin_email' =&gt; 'false', 'send_attendee_email' =&gt; 'true', 'custom_data' =&gt; array('email_type' =&gt; 'reminder', 'email_subject' =&gt; $email_subject, 'email_text' =&gt; $email_text, 'email_id' =&gt; $email_id)));
            $count++;
        }
        ?&gt;

            <strong>

                </strong>



            <strong>

                </strong>

        &lt;?php
    }
}

}

//Cancelation Notices
if (!function_exists('event_espresso_send_cancellation_notice')) {

function event_espresso_send_cancellation_notice($event_id) {
    global $wpdb, $org_options;
    do_action(&#039;action_hook_espresso_log&#039;, __FILE__, __FUNCTION__, &#039;&#039;);
    //Define email headers
    $headers = &quot;MIME-Version: 1.0\r\n&quot;;
    if ($org_options[&#039;email_fancy_headers&#039;]==&#039;Y&#039;) {
        $headers .= &quot;From: &quot; . $org_options[&#039;organization&#039;] . &quot; \r\n";
        $headers .= "Reply-To: " . $org_options['organization'] . "  \r\n";
    } else {
        $headers .= "From: " . $org_options['contact_email'] . "\r\n";
        $headers .= "Reply-To: " . $org_options['contact_email'] . "\r\n";
    }
    $headers .= "Content-Type: text/html; charset=utf-8\r\n";
    $message_top = "";
    $message_bottom = "";

    $events = $wpdb-&gt;get_results("SELECT * FROM " . EVENTS_DETAIL_TABLE . " WHERE id='" . $event_id . "'");
    foreach ($events as $event) {
        $event_name = $event-&gt;event_name;
        $event_desc = $event-&gt;event_desc;
        $send_mail = $event-&gt;send_mail;
        $conf_mail = $event-&gt;conf_mail;
        $email_id = $event-&gt;email_id;
        $alt_email = $event-&gt;alt_email;
        $start_date = $event-&gt;start_date;
        $end_date = $event-&gt;end_date;
        $event_address = $event-&gt;address;
        $event_address2 = $event-&gt;address2;
        $event_city = $event-&gt;city;
        $event_state = $event-&gt;state;
        $event_zip = $event-&gt;zip;
        $location = (!empty($event_address) ? $event_address : '') . (!empty($event_address2) ? '' . $event_address2 : '') . (!empty($event_city) ? '' . $event_city : '') . (!empty($event_state) ? ', ' . $event_state : '') . (!empty($event_zip) ? '' . $event_zip : '') . (!empty($event_country) ? '' . $event_country : '');
        $location_phone = $event-&gt;phone;

        $attendees = $wpdb-&gt;get_results("SELECT * FROM " . EVENTS_ATTENDEE_TABLE . " WHERE event_id ='" . $event_id . "'");
        foreach ($attendees as $attendee) {
            $lname = $attendee-&gt;lname;
            $fname = $attendee-&gt;fname;
            $address = $attendee-&gt;address;
            $city = $attendee-&gt;city;
            $state = $attendee-&gt;state;
            $zip = $attendee-&gt;zip;
            $attendee_email = $attendee-&gt;email;
            $phone = $attendee-&gt;phone;
            $date = $attendee-&gt;date;
            $event_id = $attendee-&gt;event_id;
            $event_time = $attendee-&gt;event_time;
            $end_time = $attendee-&gt;end_time;

            //Replace the tags
            //$tags = array("[fname]", "[lname]", "[event_name]" );
            //$vals = array($fname, $lname, $event_name);
            //$email_body = $message_top.$email_body.$message_bottom;
            //$subject = str_replace($tags,$vals,$email_subject);


            $subject = __('Event Cancellation Notice', 'event_espresso');
            $email_body = '' . sprintf( __( '%d has been cancelled.', 'event_espresso' ), $event_name ) . '';
            $email_body .= '' . sprintf( __('For more information, please email %d', 'event_espresso'), $alt_email == '' ? $org_options['contact_email'] : $alt_email ) . '';
            $body = str_replace($tags, $vals, $email_body);
            wp_mail($attendee_email, stripslashes_deep(html_entity_decode($subject, ENT_QUOTES, "UTF-8")), stripslashes_deep(html_entity_decode(wpautop($email_body), ENT_QUOTES, "UTF-8")), $headers);
        }
    }
}

}

// Attendee registration approval pending
if (!function_exists(‘event_espresso_send_attendee_registration_approval_pending’)) {

function event_espresso_send_attendee_registration_approval_pending($registration_id) {
    global $org_options, $wpdb;
    do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, '');
    //Get the event information
    $events = $wpdb-&gt;get_results("SELECT ed.* FROM " . EVENTS_DETAIL_TABLE . " ed
                    JOIN " . EVENTS_ATTENDEE_TABLE . " ea
                    ON ed.id = ea.event_id
                    WHERE ea.registration_id='" . $registration_id . "'");

    foreach ($events as $event) {
        $event_id = $event-&gt;id;
        $event_name = stripslashes_deep($event-&gt;event_name);
        $event_desc = stripslashes_deep($event-&gt;event_desc);
        $display_desc = $event-&gt;display_desc;
        $event_identifier = $event-&gt;event_identifier;
        $reg_limit = $event-&gt;reg_limit;
        $active = $event-&gt;is_active;
        $send_mail = $event-&gt;send_mail;
        $conf_mail = $event-&gt;conf_mail;
        $email_id = $event-&gt;email_id;
        $alt_email = $event-&gt;alt_email;
        $start_date = event_date_display($event-&gt;start_date);
        $end_date = $event-&gt;end_date;
        $virtual_url = $event-&gt;virtual_url;
        $virtual_phone = $event-&gt;virtual_phone;
        $event_address = $event-&gt;address;
        $event_address2 = $event-&gt;address2;
        $event_city = $event-&gt;city;
        $event_state = $event-&gt;state;
        $event_zip = $event-&gt;zip;
        $event_country = $event-&gt;country;
        $location = ($event_address != '' ? $event_address : '') . ($event_address2 != '' ? '' . $event_address2 : '') . ($event_city != '' ? '' . $event_city : '') . ($event_state != '' ? ', ' . $event_state : '') . ($event_zip != '' ? '' . $event_zip : '') . ($event_country != '' ? '' . $event_country : '');
        $location_phone = $event-&gt;phone;
        $require_pre_approval = $event-&gt;require_pre_approval;

        $google_map_link = espresso_google_map_link(array('address' =&gt; $event_address, 'city' =&gt; $event_city, 'state' =&gt; $event_state, 'zip' =&gt; $event_zip, 'country' =&gt; $event_country));
    }

    //Build links
    $event_url = espresso_reg_url($event_id);
    $event_link = '<a href="' . $event_url . '">' . $event_name . '</a>';

    $sql = "SELECT * FROM " . EVENTS_ATTENDEE_TABLE;

    if ($registration_id != '') {
        $sql .= " WHERE registration_id = '" . $registration_id . "' ";
    } elseif ($attendee_id != '') {
        $sql .= " WHERE id = '" . $attendee_id . "' ";
    } else {
        _e('No ID Supplied', 'event_espresso');
    }

    $sql .= " ORDER BY id ";
    $sql .= " LIMIT 0,1 "; //Get the first attendees details


    $attendees = $wpdb-&gt;get_results($sql);
    //global $attendee_id;

    foreach ($attendees as $attendee) {
        $attendee_id = $attendee-&gt;id;
        $attendee_email = $attendee-&gt;email;
        $lname = $attendee-&gt;lname;
        $fname = $attendee-&gt;fname;
        $address = $attendee-&gt;address;
        $address2 = $attendee-&gt;address2;
        $city = $attendee-&gt;city;
        $state = $attendee-&gt;state;
        $zip = $attendee-&gt;zip;
        $payment_status = $attendee-&gt;payment_status;
        $txn_type = $attendee-&gt;txn_type;
        $amount_pd = $attendee-&gt;amount_pd;
        $event_cost = $attendee-&gt;amount_pd;
        $payment_date = event_date_display($attendee-&gt;payment_date);
        $phone = $attendee-&gt;phone;
        $event_time = event_date_display($attendee-&gt;event_time, get_option('time_format'));
        $end_time = event_date_display($attendee-&gt;end_time, get_option('time_format'));
        $date = event_date_display($attendee-&gt;date);
        $pre_approve = $attendee-&gt;pre_approve;
    }
    $admin_email = $alt_email == '' ? $org_options['contact_email'] : $alt_email . ',' . $org_options['contact_email'];
    if (!empty($admin_email)) {
        $subject = __('New attendee registration approval pending','event_espresso');
        $body = sprintf( __('Event title: %s', 'event_espresso'), $event_name );
        $body .= '';
        $body .= sprintf( __('Attendee name: %1$s %2$s', 'event_espresso'), $fname, $lname );
        $body .= '';
        $body .= __('Thank You.', 'event_espresso');
        $email_params = array(
                'send_to' =&gt; $admin_email,
                'email_subject' =&gt; __($subject, 'event_espresso'),
                'email_body' =&gt; $body
        );
        event_espresso_send_email($email_params);
    }

    if (!empty($attendee_email)) {
        $subject = __('Event registration pending','event_espresso');
        $body = sprintf( __('Event title: %s', 'event_espresso'), $event_name );
        $body .= '';
        $body .= sprintf( __('Attendee name: %1$s %2$s', 'event_espresso'), $fname, $lname );
        $body .= '';
        $body .= __('Your registration is pending for approval from event admin. You will receive an email with payment info when admin approves your registration.', 'event_espresso');
        $body .= '';
        $body .= __('Thank You.', 'event_espresso');
        $email_params = array(
                'send_to' =&gt; $attendee_email,
                'email_subject' =&gt; __($subject, 'event_espresso'),
                'email_body' =&gt; $body
        );
        event_espresso_send_email($email_params);
    }
}

}

/**
* @ print_r an array
* @ access public
* @ return void
*/
function printr($var, $var_name = ‘ARRAY’, $height = ‘auto’) {

echo '<pre>';
echo '' . $var_name . '';
echo print_r($var);
echo '</pre>';

}


Chris Reynolds

  • Support Staff

August 22, 2012 at 10:44 am

Okay, that was more information than I needed and doesn’t really help me all that much. Can you just post the actual function that you added your code to and indicate where you added your code specifically? It’s possible that this might work better as a Gist or on Piratepad.


Candi Stroh

August 22, 2012 at 11:01 am

Ok that is pretty cool. The link is below
http://piratepad.net/RAnQKNdREt


Candi Stroh

August 22, 2012 at 11:08 am

Sorry wrong post!

  • This reply was modified 10 years, 5 months ago by  Candi Stroh.


Chris Reynolds

  • Support Staff

August 22, 2012 at 11:36 am

Okay, your problem is coming from this line:

        $data->attendee->event_price;

because the event_price is not called that in the wp_events_attendee table. Try changing that line to:

        $data->attendee->amount_pd;


Candi Stroh

August 22, 2012 at 12:02 pm

That worked!

The support post ‘Display Price in Confirmation Admin Email’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso