Testing out some possible ways to email.
authorLaury GvR <laury@gaslightmedia.com>
Wed, 11 Nov 2015 14:18:12 +0000 (09:18 -0500)
committerLaury GvR <laury@gaslightmedia.com>
Wed, 11 Nov 2015 14:18:12 +0000 (09:18 -0500)
includes/payment-display.php
includes/payment-email.php [new file with mode: 0644]
includes/payment-function.php
includes/payment-options.php

index 22c4d84..fc32aeb 100755 (executable)
@@ -55,7 +55,7 @@
                define("AUTHORIZENET_MD5_SETTING","");                // Add your MD5 Setting.\r
 \r
                $REQUEST = $_REQUEST;\r
-               if($paypalp = authorizepayment($METHOD_TO_USE,$REQUEST,$address1,$city,$state,$country,$zipcode,$emailaddress,$plan))\r
+               if(authorizepayment($METHOD_TO_USE,$REQUEST,$address1,$city,$state,$country,$zipcode,$emailaddress,$plan))\r
                {\r
                        $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`) \r
                        VALUES ('".$first_name."', '".$last_name."','".$organization."','".$address."','".$city."','".$country."','".$state."','".$zip."','".$phone."','".$email."','".$donation_type."','".$amount."','".$invoice_num."','".$comment."', '1',now());";\r
                        \r
                        $post = get_post($post->ID);\r
                        $slug = $post->post_name;\r
-                       \r
+                        \r
+                        wp_mail( 'laury@localhost', 'test1a', 'pass');\r
+                        paymentemail($first_name,$last_name,$organisation,$donation_type,$amount,$invoice_num,$comment);\r
+                        wp_mail( 'laury@localhost', 'test1b', 'pass');\r
+                        \r
                        header("Location:".site_url().$_SERVER['REQUEST_URI']);\r
                        exit;\r
                }\r
                else\r
                {\r
+                        wp_mail( 'laury@localhost', 'test1c', 'pass');\r
                        header("Location:".site_url().$_SERVER['REQUEST_URI']);\r
                        exit;\r
                }\r
diff --git a/includes/payment-email.php b/includes/payment-email.php
new file mode 100644 (file)
index 0000000..e69de29
index c3f6b96..1721d23 100755 (executable)
@@ -55,6 +55,7 @@ function authorizepayment($METHOD_TO_USE,$REQUEST,$address1='',$city='',$state='
                                        // Redirect the user back to your site.\r
                                        //$return_url = $site_root . 'thank_you_page.php?transaction_id=' .$response->transaction_id;\r
                                        //echo "2";\r
+                                    paymentemail();\r
                                        \r
                                        return true;\r
                                }\r
@@ -287,5 +288,21 @@ function checkCreditCard($cardnumber, $cardname, &$errornumber, &$errortext) {
        return true;\r
 }\r
 \r
+function paymentemail($first_name = 'fname',$last_name ='lname',$organisation = 'orgname',\r
+        $donation_type = 'dontype',$amount = 'amount',$invoice_num = 'invnum',$comment = 'comment') {\r
+//            paymentemail($first_name,$last_name,$organisation,$donation_type,$amount,$invoice_num,$comment);\r
+    $to = "laury@localhost";\r
+    $subject = 'wp_mail function test 2';\r
+//            $message = 'This is a test of the wp_mail function: wp_mail is working';\r
+    $message = 'A payment has been made on the Gaslight Media website. Please review the billing information below' . \r
+            '<br>Name: ' . $last_name . ', ' . $first_name . '<br>Organisation: ' . $organisation  . '<br>Donation Type: ' . \r
+            $donation_type . '<br>Amount: ' . $amount . '<br>Invoice Number: ' . $invoice_num . '<br>Comments: ' . $comment;\r
+    $headers = array();\r
+    $headers[] = 'From: Gaslight Media <laury@gaslightmedia.com>';\r
+    $headers[] = 'Reply-To: noreply@gaslightmedia.com';\r
+    $headers[] = 'Content-Type: text/html';\r
+    $headers[] = 'charset=utf-8';\r
 \r
+    $sent_message = wp_mail( $to, $subject, $message, $headers );\r
+}\r
 ?>\r
index 20a2ed0..edefa33 100755 (executable)
@@ -110,22 +110,56 @@ function glm_payment_options_page()
             jQuery("#glm-payments-tabs").tabs();\r
         });\r
     </script>\r
-\r
     <div id="glm-payments-tabs">\r
         <h1 class="payment-title">GLM Payment</h1>\r
         <ul id="glm-payments-tabs-nav">\r
             <li><a href="#glm-payments-tab-donorlist">Payment List</a></li>\r
             <li><a href="#glm-payments-tab-settings">Settings</a></li>\r
+            <li><a href="#glm-payments-tab-mail">Mail</a></li>\r
         </ul>\r
         <div style="clear:both"></div>\r
+        <div id="glm-payments-tab-mail">\r
+            \r
+\r
+            <?php\r
+            \r
+//            paymentemail($first_name,$last_name,$organisation,$donation_type,$amount,$invoice_num,$comment);\r
+//            $message = 'This is a test of the wp_mail function: wp_mail is working';\r
+//            $first_name = 'fname';\r
+//            $last_name = 'lname';\r
+//            $organisation = 'org';\r
+//            $donation_type = 'dontype';\r
+//            $amount = 'amt';\r
+//            $invoice_num = 'invnum';\r
+//            $comment = 'comment';\r
+//            $to = "laury@localhost";\r
+//            $subject = 'wp_mail function test';\r
+//            $message = 'A payment has been made on the Gaslight Media website. Please review the billing information below' . \r
+//                    '<br>Name: ' . $last_name . ', ' . $first_name . '<br>Organisation: ' . $organisation  . '<br>Donation Type: ' . \r
+//                    $donation_type . '<br>Amount: ' . $amount . '<br>Invoice Number: ' . $invoice_num . '<br>Comments: ' . $comment;\r
+//            $headers = array();\r
+//            $headers[] = 'From: Gaslight Media <laury@gaslightmedia.com>';\r
+//            $headers[] = 'Reply-To: noreply@gaslightmedia.com';\r
+//            $headers[] = 'Content-Type: text/html';\r
+//            $headers[] = 'charset=utf-8';\r
+//            \r
+//            $sent_message = wp_mail( $to, $subject, $message, $headers );\r
+//            if ( $sent_message ) {\r
+//                echo 'The test message was sent. Check your email inbox.';\r
+//            } else {\r
+//                echo 'The message was not sent!';\r
+//            }\r
+            ?>\r
+            \r
+        </div>\r
         <div id="glm-payments-tab-donorlist">\r
             <table class="glm-payments-donorlist" width="100%">\r
-              <?php \r
-              global $wpdb;\r
-                               $myrows = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."payment");\r
-                               if(count($myrows)>0)\r
-                               {\r
-              ?>\r
+                <?php \r
+                    global $wpdb;\r
+                    $myrows = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."payment");\r
+                    if(count($myrows)>0)\r
+                    {\r
+                ?>\r
               <thead>\r
                 <tr class="glm-payments-absolute">\r
                   <th align="left">Person</th>\r
@@ -136,56 +170,56 @@ function glm_payment_options_page()
                   <th align="left">Action</th>\r
                 </tr>\r
                     <?php \r
-                            foreach($myrows as $myrows_value)\r
-                            {\r
-                            ?>\r
-                            <tr>\r
-                                    <td><a href="<?php echo site_url();?>/wp-admin/admin.php?page=glm_payment&id=<?php echo $myrows_value->id;?>"><?php echo $myrows_value->first_name.' '.$myrows_value->last_name ;?></a></td>\r
-                                    <td><?php echo $myrows_value->email;?></td>\r
-                                    <td>$<?php echo $myrows_value->amount;?></td>\r
-                                    <td><?php echo $myrows_value->date;?></td>\r
-                                    <td><?php echo $myrows_value->comment;?></td>\r
-                                    <td><a onclick="return confirm('Are you sure?')" href="<?php echo site_url();?>/wp-admin/admin.php?page=glm_payment&action=delete&id=<?php echo $myrows_value->id;?>">Delete</a></td>\r
-                            </tr>\r
-                            <?php \r
-                            \r
-                            ?>\r
+                        foreach($myrows as $myrows_value)\r
+                        {\r
+                        ?>\r
+                        <tr>\r
+                            <td><a href="<?php echo site_url();?>/wp-admin/admin.php?page=glm_payment&id=<?php echo $myrows_value->id;?>"><?php echo $myrows_value->first_name.' '.$myrows_value->last_name ;?></a></td>\r
+                            <td><?php echo $myrows_value->email;?></td>\r
+                            <td>$<?php echo $myrows_value->amount;?></td>\r
+                            <td><?php echo $myrows_value->date;?></td>\r
+                            <td><?php echo $myrows_value->comment;?></td>\r
+                            <td><a onclick="return confirm('Are you sure?')" href="<?php echo site_url();?>/wp-admin/admin.php?page=glm_payment&action=delete&id=<?php echo $myrows_value->id;?>">Delete</a></td>\r
+                        </tr>\r
+                        <?php \r
+                        } \r
+                        ?>\r
               </thead>\r
               <?php \r
-                               }\r
-                               else\r
-                               {\r
-                               echo "No Record's Found.";      \r
-                               }\r
+                    }\r
+                    else\r
+                    {\r
+                    echo "No Record's Found."; \r
+                    }\r
               ?>\r
             </table>\r
         </div>\r
-        <div id="glm-payments-tab-settings">                   \r
-                       <?php\r
-                       global $wpdb;\r
-                       $mysetting = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."payment_setting" );                                            \r
-                       ?>\r
-                       <form action="<?php echo site_url();?>/wp-admin/admin.php?page=glm_payment" method="post" name="setting" id="setting">\r
-                               <input type="hidden" name="setting" value="1" />\r
-                               <ul style="color:#777">\r
-                                       <li>\r
-                                               <strong>Authorize.net Mode</strong> \r
-                                               <select class="inputbox" name="authnet_mode" id="paramsauthnet_mode">\r
-                                                       <option value="0" <?php if($mysetting[0]->mod==0){?> selected="selected" <?php }?> >Test Mode</option>\r
-                                                       <option <?php if($mysetting[0]->mod==1){?> selected="selected" <?php }?> value="1">Live Mode</option>\r
-                                               </select>\r
-                                       </li>\r
-                                       <li>\r
-                                               <strong>API Login</strong> \r
-                                               <input type="text" size="50" class="text_area" value="<?php echo $mysetting[0]->api_login;?>" id="paramsx_login" name="x_login">\r
-                                       </li>\r
-                                       <li>\r
-                                               <strong>Transaction Key</strong> \r
-                                               <input type="text" class="text_area" value="<?php echo $mysetting[0]->key;?>" id="paramsx_tran_key" name="x_tran_key">\r
-                                       </li>\r
-                                       <br />\r
-                                       <input type="submit" value="Submit" />                                  \r
-                               </ul>\r
+        <div id="glm-payments-tab-settings">   \r
+            <?php\r
+            global $wpdb;\r
+            $mysetting = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."payment_setting" );                                               \r
+            ?>\r
+            <form action="<?php echo site_url();?>/wp-admin/admin.php?page=glm_payment" method="post" name="setting" id="setting">\r
+                <input type="hidden" name="setting" value="1" />\r
+                <ul style="color:#777">\r
+                    <li>\r
+                        <strong>Authorize.net Mode</strong> \r
+                        <select class="inputbox" name="authnet_mode" id="paramsauthnet_mode">\r
+                            <option value="0" <?php if($mysetting[0]->mod==0){?> selected="selected" <?php }?> >Test Mode</option>\r
+                            <option <?php if($mysetting[0]->mod==1){?> selected="selected" <?php }?> value="1">Live Mode</option>\r
+                        </select>\r
+                    </li>\r
+                    <li>\r
+                        <strong>API Login</strong> \r
+                        <input type="text" size="50" class="text_area" value="<?php echo $mysetting[0]->api_login;?>" id="paramsx_login" name="x_login">\r
+                    </li>\r
+                    <li>\r
+                        <strong>Transaction Key</strong> \r
+                        <input type="text" class="text_area" value="<?php echo $mysetting[0]->key;?>" id="paramsx_tran_key" name="x_tran_key">\r
+                    </li>\r
+                    <br />\r
+                    <input type="submit" value="Submit" />                                     \r
+                </ul>\r
             </form>\r
         </div>\r
         \r