From c4ee33e57b803a674e24a3de0634fd468a3723a1 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 5 Dec 2016 15:50:36 -0500 Subject: [PATCH] Updates for notify. Don't try the admin email if no email is set. --- classes/helper/notification.php | 3 +++ models/admin/coupons/list.php | 15 ++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/classes/helper/notification.php b/classes/helper/notification.php index 0eaebcd..33bbf05 100644 --- a/classes/helper/notification.php +++ b/classes/helper/notification.php @@ -152,6 +152,9 @@ class GlmMembersAdmin_coupon_notification extends GlmDataMembers $notify_to = $settings['notify_to']; $notify_from = $settings['notify_from']; $notify_message = $settings['notify_message']; + if ( !$notify_to ) { + return false; + } // Setup the Smarty Engine $smarty = new smartyTemplateSupport(); diff --git a/models/admin/coupons/list.php b/models/admin/coupons/list.php index 57d4b5c..a775096 100644 --- a/models/admin/coupons/list.php +++ b/models/admin/coupons/list.php @@ -136,6 +136,7 @@ class GlmMembersAdmin_coupons_list extends GlmDataCoupons $namesList = false; $enable_members = $this->config['settings']['enable_members']; + // Load Notifications from the helper classes include_once GLM_MEMBERS_COUPONS_PLUGIN_CLASS_PATH . '/helper/notification.php'; $notification = new GlmMembersAdmin_coupon_notification( $this->wpdb, $this->config ); @@ -227,24 +228,24 @@ class GlmMembersAdmin_coupons_list extends GlmDataCoupons if ( $coupon ) { $this->couponID = $coupon['fieldData']['id']; $this->updateCategories(); - $categories = $Categories->getList(false); + $categories = $Categories->getList( false ); - if ($coupon['status']) { + if ( $coupon['status'] ) { $haveCoupon = true; $couponAdded = true; // Update created timestamp and name slug for URLs - $this->updateTimestamp('created', $this->couponID); - $this->updateSlug($this->couponID); + $this->updateTimestamp( 'created', $this->couponID ); + $this->updateSlug( $this->couponID ); // Get this again so we have the created date - $coupon = $this->editEntry($this->couponID); + $coupon = $this->editEntry( $this->couponID ); $option = 'edit'; $couponAdded = true; if ( $lockedToMember ) { - if ( isset( $_REQUEST['ref_dest'] ) && $member_id = filter_var( $_REQUEST['ref_dest']) ) { - $notification->sendAdminNotice( $member_id, $coupon); + if ( isset( $_REQUEST['ref_dest'] ) && $member_id = filter_var( $_REQUEST['ref_dest'] ) ) { + $notification->sendAdminNotice( $member_id, $coupon ); } } -- 2.17.1