From 8b9d30b187588da413222189f69a16970c96dcd8 Mon Sep 17 00:00:00 2001 From: Laury GvR Date: Wed, 11 Nov 2015 09:18:12 -0500 Subject: [PATCH] Testing out some possible ways to email. --- includes/payment-display.php | 9 ++- includes/payment-email.php | 0 includes/payment-function.php | 17 +++++ includes/payment-options.php | 138 +++++++++++++++++++++------------- 4 files changed, 110 insertions(+), 54 deletions(-) create mode 100644 includes/payment-email.php diff --git a/includes/payment-display.php b/includes/payment-display.php index 22c4d84..fc32aeb 100755 --- a/includes/payment-display.php +++ b/includes/payment-display.php @@ -55,7 +55,7 @@ define("AUTHORIZENET_MD5_SETTING",""); // Add your MD5 Setting. $REQUEST = $_REQUEST; - if($paypalp = authorizepayment($METHOD_TO_USE,$REQUEST,$address1,$city,$state,$country,$zipcode,$emailaddress,$plan)) + if(authorizepayment($METHOD_TO_USE,$REQUEST,$address1,$city,$state,$country,$zipcode,$emailaddress,$plan)) { $sql = "INSERT INTO `".$wpdb->prefix."payment` (`first_name`, `last_name`, `organization`, `address`, `city`, `country`, `state`, `zip`, `phone`, `email`, `donation_type`, `amount`, `invoice_num`,`comment`, `status`,`date`) VALUES ('".$first_name."', '".$last_name."','".$organization."','".$address."','".$city."','".$country."','".$state."','".$zip."','".$phone."','".$email."','".$donation_type."','".$amount."','".$invoice_num."','".$comment."', '1',now());"; @@ -63,12 +63,17 @@ $post = get_post($post->ID); $slug = $post->post_name; - + + wp_mail( 'laury@localhost', 'test1a', 'pass'); + paymentemail($first_name,$last_name,$organisation,$donation_type,$amount,$invoice_num,$comment); + wp_mail( 'laury@localhost', 'test1b', 'pass'); + header("Location:".site_url().$_SERVER['REQUEST_URI']); exit; } else { + wp_mail( 'laury@localhost', 'test1c', 'pass'); header("Location:".site_url().$_SERVER['REQUEST_URI']); exit; } diff --git a/includes/payment-email.php b/includes/payment-email.php new file mode 100644 index 0000000..e69de29 diff --git a/includes/payment-function.php b/includes/payment-function.php index c3f6b96..1721d23 100755 --- a/includes/payment-function.php +++ b/includes/payment-function.php @@ -55,6 +55,7 @@ function authorizepayment($METHOD_TO_USE,$REQUEST,$address1='',$city='',$state=' // Redirect the user back to your site. //$return_url = $site_root . 'thank_you_page.php?transaction_id=' .$response->transaction_id; //echo "2"; + paymentemail(); return true; } @@ -287,5 +288,21 @@ function checkCreditCard($cardnumber, $cardname, &$errornumber, &$errortext) { return true; } +function paymentemail($first_name = 'fname',$last_name ='lname',$organisation = 'orgname', + $donation_type = 'dontype',$amount = 'amount',$invoice_num = 'invnum',$comment = 'comment') { +// paymentemail($first_name,$last_name,$organisation,$donation_type,$amount,$invoice_num,$comment); + $to = "laury@localhost"; + $subject = 'wp_mail function test 2'; +// $message = 'This is a test of the wp_mail function: wp_mail is working'; + $message = 'A payment has been made on the Gaslight Media website. Please review the billing information below' . + '
Name: ' . $last_name . ', ' . $first_name . '
Organisation: ' . $organisation . '
Donation Type: ' . + $donation_type . '
Amount: ' . $amount . '
Invoice Number: ' . $invoice_num . '
Comments: ' . $comment; + $headers = array(); + $headers[] = 'From: Gaslight Media '; + $headers[] = 'Reply-To: noreply@gaslightmedia.com'; + $headers[] = 'Content-Type: text/html'; + $headers[] = 'charset=utf-8'; + $sent_message = wp_mail( $to, $subject, $message, $headers ); +} ?> diff --git a/includes/payment-options.php b/includes/payment-options.php index 20a2ed0..edefa33 100755 --- a/includes/payment-options.php +++ b/includes/payment-options.php @@ -110,22 +110,56 @@ function glm_payment_options_page() jQuery("#glm-payments-tabs").tabs(); }); -

GLM Payment

+
+ + + Name: ' . $last_name . ', ' . $first_name . '
Organisation: ' . $organisation . '
Donation Type: ' . +// $donation_type . '
Amount: ' . $amount . '
Invoice Number: ' . $invoice_num . '
Comments: ' . $comment; +// $headers = array(); +// $headers[] = 'From: Gaslight Media '; +// $headers[] = 'Reply-To: noreply@gaslightmedia.com'; +// $headers[] = 'Content-Type: text/html'; +// $headers[] = 'charset=utf-8'; +// +// $sent_message = wp_mail( $to, $subject, $message, $headers ); +// if ( $sent_message ) { +// echo 'The test message was sent. Check your email inbox.'; +// } else { +// echo 'The message was not sent!'; +// } + ?> + +
- get_results( "SELECT * FROM ".$wpdb->prefix."payment"); - if(count($myrows)>0) - { - ?> + get_results( "SELECT * FROM ".$wpdb->prefix."payment"); + if(count($myrows)>0) + { + ?> @@ -136,56 +170,56 @@ function glm_payment_options_page() - - - - - - - - - + foreach($myrows as $myrows_value) + { + ?> + + + + + + + + +
PersonAction
first_name.' '.$myrows_value->last_name ;?>email;?>$amount;?>date;?>comment;?>Delete
first_name.' '.$myrows_value->last_name ;?>email;?>$amount;?>date;?>comment;?>Delete
-
- get_results( "SELECT * FROM ".$wpdb->prefix."payment_setting" ); - ?> -
- -
    -
  • - Authorize.net Mode - -
  • -
  • - API Login - -
  • -
  • - Transaction Key - -
  • -
    - -
+
+ get_results( "SELECT * FROM ".$wpdb->prefix."payment_setting" ); + ?> + + +
    +
  • + Authorize.net Mode + +
  • +
  • + API Login + +
  • +
  • + Transaction Key + +
  • +
    + +
-- 2.17.1