Update the replyto address for admin notifications
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 25 Jul 2017 18:58:56 +0000 (14:58 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 25 Jul 2017 18:58:56 +0000 (14:58 -0400)
Use the admin contact email for the replyto if available.

classes/helper/notification.php
models/front/events/frontAdd.php

index 68ab638..54e7032 100644 (file)
@@ -198,10 +198,12 @@ class GlmMembersAdmin_event_notification extends GlmDataMembers
         // Send confirmation email, set the content type to allow html by using this filter
         add_filter( 'wp_mail_content_type', array( $this, 'set_content_type' ) );
 
+        // Set the Reply-To to use Admin Contact E-Mail
+        $replyTo  = ( $event['fieldData']['admin_email'] ) ? $event['fieldData']['admin_email']: $notify_from;
         $subject  = 'Event Form Submission';
         $message  = $htmlMessage;
         $header[] = 'From:' . $notify_from;
-        $header[] = 'Reply-To:' . $notify_from;
+        $header[] = 'Reply-To:' . $replyTo;
 
         wp_mail( $notify_to, $subject, $message, $header );
 
index 42e3915..2b58013 100644 (file)
@@ -192,7 +192,7 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents
             GLM_MEMBERS_PLUGIN_VERSION
         );
         wp_enqueue_script('glm-members-front-maskedinput');
-        
+
         // Set initial values for variables.
         $fromDate       = '';
         $permalink      = '';
@@ -269,18 +269,18 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents
         //Load Events class
         $events   = new GlmDataEvents($this->wpdb, $this->config );
         $newEvent = $events->newEntry();
-        
+
         $confirmation_page_id = get_option('glm_members_database_option_event_confirmation_id');
         $redirect_url = get_permalink($confirmation_page_id);
-        
-        
+
+
         // if form is submitted
         if ( isset( $_REQUEST['newEvent'] ) && $_REQUEST['newEvent'] == "Add Event" ) {
 
             // Check to see if the honey pot caught spam.
             if ( isset( $_REQUEST['real_email'] ) && $_REQUEST['real_email'] ) {
                 $view = 'confirmation';
-    
+
 //                header("Location: $redirect_url"); /* Redirect browser */
             } else {
                 // parse dates and times
@@ -663,29 +663,29 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents
 //                    }
 //                    // Send confirmation email, set the content type to allow html by using this filter
                     add_filter( 'wp_mail_content_type', 'set_content_type' );
-                    
+
                     $site_name = get_bloginfo('name');
                     $to      = $to_email;
                     $subject = 'Event Form Submission';
-                    
+
                     $message = $htmlMessage;
                     $userBody = $userMessage;
 
                     $header[] = "From: $site_name <$fromEmail>";
-                    $header[] = 'Reply-To:' . $adminEmail;    
-                    
+                    $header[] = 'Reply-To:' . $adminEmail;
+
                     wp_mail($to, $subject, $message, $header);
-                    
+
                     // send a copy to the user submitting the email, using different headers and email template file
                     $userHeader[] = "From: $site_name <$fromEmail>";
-                    $userHeader[] = 'Reply-To: No-Reply@gaslightmedia.com';  
-                    
+                    $userHeader[] = 'Reply-To: No-Reply@gaslightmedia.com';
+
                     if(wp_mail($adminEmail, $subject, $userBody, $userHeader)){
-                       
+
                     } else {
                         echo "Error: Message Not Sent";
                     }
-                    
+
                     // remove the filter to avoid conflicts
                     remove_filter( 'wp_mail_content_type', 'set_content_type' );
                 }
@@ -718,7 +718,7 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents
             'to_email'          => $to_email,
             'from_email'        => $fromEmail,
             'notification'      => $emailNotification,
-            'confirmation_page' => $redirect_url, 
+            'confirmation_page' => $redirect_url,
             'mainImgUrl'     => GLM_MEMBERS_PLUGIN_MEDIA_URL . '/images/large/'
         );