function eshop_send_customer_email($checked, $mg_id)
 {
     global $wpdb;
     //runcode - return false to stop the rest from running.
     //checked is reference for db, mg_id is the email template to use
     $runcode = true;
     $runcode = apply_filters('eshop_send_customer_email_replace', $runcode, $checked, $mg_id);
     //this is an email sent to the customer:
     //first extract the order details
     $array = eshop_rtn_order_details($checked);
     $etable = $wpdb->prefix . 'eshop_emails';
     //grab the template
     $thisemail = $wpdb->get_row("SELECT emailSubject,emailContent FROM " . $etable . " WHERE (id='" . $mg_id . "' AND emailUse='1') OR id='1'  order by id DESC limit 1");
     $this_email = stripslashes($thisemail->emailContent);
     // START SUBST
     $csubject = stripslashes($thisemail->emailSubject);
     $this_email = eshop_email_parse($this_email, $array);
     //try and decode various bits
     $this_email = html_entity_decode($this_email, ENT_QUOTES);
     $headers = eshop_from_address();
     if ($runcode == true) {
         wp_mail($array['eemail'], $csubject, $this_email, $headers);
     }
     do_action('eshop_send_customer_email', $csubject, $this_email, $headers, $array);
     //affiliate
     if ($array['affiliate'] != '') {
         // to allow for the removal of shipping vlaue from the order. total is sent by default, shipping can be removed.
         $sale_amt = apply_filters('eShop_aff_order_total', $array['total'], $array['shipping_charge']);
         //for affiliates.
         $affcheck = apply_filters('eShop_aff_order_check', true, $array);
         if ($affcheck == true) {
             do_action('eShop_process_aff_commission', array("id" => $array['affiliate'], "sale_amt" => $sale_amt, "txn_id" => $array['transid'], "buyer_email" => $array['eemail']));
         }
     }
     //this is fired on successful purchase, so might as well have this action here
     do_action('eshop_on_success', $checked);
 }
Exemplo n.º 2
0
    echo '<p class="success">' . __('Email sent successfully.', 'eshop') . '</p>';
    echo '<p><a class="return" href="' . $page . '">' . __('&laquo; Return to Order Detail', 'eshop') . '</a></p>';
} elseif (isset($_GET['viewemail'])) {
    $view = esc_sql($_GET['viewemail']);
    $dtable = $wpdb->prefix . 'eshop_orders';
    $checked = $wpdb->get_var("Select checkid From {$dtable} where id='{$view}'");
    $email = $wpdb->get_var("Select email From {$dtable} where id='{$view}'");
    $array = eshop_rtn_order_details($checked);
    //grab the template
    $table = $wpdb->prefix . 'eshop_emails';
    $thisemail = $wpdb->get_row("Select * From {$table} where id='2' LIMIT 1");
    $subject = $thisemail->emailSubject;
    $this_email = $thisemail->emailContent;
    // START SUBST
    //yes downloads
    $this_email = eshop_email_parse($this_email, $array, 'yes');
    $this_email = str_replace('&#8230;', '...', $this_email);
    // For system email -
    if ($eshopoptions['business'] != '') {
        $from = $eshopoptions['business'];
    } else {
        //nicked from wp_mail function!
        $from = "system@" . preg_replace('#^www\\.#', '', strtolower($_SERVER['SERVER_NAME']));
    }
    ?>
	<div id="eshopemailform"><form id="emailer" action="<?php 
    echo esc_url($_SERVER['REQUEST_URI']);
    ?>
" method="post">
	<fieldset><legend><?php 
    _e('Send a notification to:', 'eshop');