Update the wp_mail calls for setting from name.
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 22 May 2018 12:28:56 +0000 (08:28 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 22 May 2018 12:28:56 +0000 (08:28 -0400)
Using the wordpress hook to set the from header name.
Also found a typo when using reg_org_name. (correcting...)

classes/regCartSupport.php
models/admin/registrations/sendNotifications.php

index 7b3e3a5..a77d150 100644 (file)
@@ -1287,12 +1287,13 @@ class GlmRegCartSupport
      */
     public function sendHtmlEmail( $to, $subject, $htmlMessage )
     {
-
+        // Set the From name using this wordpress hook.
+        add_filter( 'wp_mail_from_name', function ($name) { return $this->config['settings']['reg_org_name']; });
         // 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' ) );
 
         $message  = $htmlMessage;
-        $header[] = 'From:' . $this->config['settings']['reg_org_namel'].' <'.$this->config['settings']['reg_org_from_email'].'>';
+        $header[] = 'From:' . $this->config['settings']['reg_org_name'].' <'.$this->config['settings']['reg_org_from_email'].'>';
         $header[] = 'Reply-To:' . $this->config['settings']['reg_org_from_email'];
 
         wp_mail( $to, $subject, $message, $header );
index 4b13642..7907b25 100644 (file)
@@ -272,6 +272,8 @@ class GlmMembersAdmin_registrations_sendNotifications extends GlmDataRegistratio
     public function sendHtmlEmail($from, $to, $subject, $htmlMessage)
     {
 
+        // Set the From name using this wordpress hook.
+        add_filter( 'wp_mail_from_name', function ($name) { return $this->config['settings']['reg_org_name']; });
         // 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' ) );