]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/admin/what-send_coupon.php
Wrapper function for configuration introduced, config entry renamed:
[mailer.git] / inc / modules / admin / what-send_coupon.php
index b304dbe7bada516e5bf1f2f642d5d2af1ee3c620..84309479f8c63f8d0573fcdd9cde9562c6d0a055 100644 (file)
@@ -108,7 +108,7 @@ if (isFormSent()) {
                                );
 
                                // Load member email template
-                               $mailText = loadEmailTemplate('member_coupon', $content, $userid);
+                               $mailText = loadEmailTemplate('member_coupon_code', $content, $userid);
 
                                // And deliver it
                                sendEmail($userid, '{--MEMBER_COUPON_SUBJECT--}', $mailText);
@@ -116,24 +116,27 @@ if (isFormSent()) {
                                // Rember this user for the admin email
                                $adminUserids[] = $userid;
                        } // END - while
+
+                       // Prepare content for template
+                       $content = array(
+                               'userids'            => implode(',', $adminUserids),
+                               'userid_count'       => count($adminUserids),
+                               'coupon_id'          => $couponId,
+                               'points'             => bigintval(postRequestParameter('points')),
+                               'coupon_description' => postRequestParameter('coupon_description'),
+                               'coupon_expired'     => generateDateTime($expirationTime, '0')
+                       );
+
+                       // Send admin notification
+                       sendAdminNotification('{--ADMIN_COUPON_SUBJECT--}', 'admin_coupon_code', $content);
+
+                       // Coupon has been sent
+                       displayMessage('{--ADMIN_SEND_COUPON_DONE--}');
                } else {
                        // No user was found
                        displayMessage('{--ADMIN_SEND_COUPON_USER_404--}');
                }
 
-               // Prepare content for template
-               $content = array(
-                       'userids'            => implode(',', $adminUserids),
-                       'userid_count'       => count($adminUserids),
-                       'coupon_id'          => $couponId,
-                       'points'             => bigintval(postRequestParameter('points')),
-                       'coupon_description' => postRequestParameter('coupon_description'),
-                       'coupon_expired'     => generateDateTime($expirationTime, '0')
-               );
-
-               // Send admin notification
-               sendAdminNotification('{--ADMIN_COUPON_SUBJECT--}', 'admin_coupon', $content);
-
                // Free result
                SQL_FREERESULT($result);
        }