File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -958,8 +958,9 @@ public function hookActionCustomerAccountAdd($params)
958958 if ($ params ['newCustomer ' ]->newsletter && $ code = Configuration::get ('NW_VOUCHER_CODE ' )) {
959959 $ this ->sendVoucher ($ email , $ code );
960960 }
961-
962- return (bool ) Db::getInstance ()->execute ('DELETE FROM ' . _DB_PREFIX_ . 'emailsubscription WHERE id_shop= ' . (int ) $ id_shop . ' AND email= \'' . pSQL ($ email ) . "' " );
961+ if ($ params ['newCustomer ' ]->newsletter ) {
962+ return (bool ) Db::getInstance ()->execute ('DELETE FROM ' . _DB_PREFIX_ . 'emailsubscription WHERE id_shop= ' . (int ) $ id_shop . ' AND email= \'' . pSQL ($ email ) . "' " );
963+ }
963964 }
964965
965966 if ($ newsletter ) {
@@ -978,6 +979,8 @@ public function hookActionObjectCustomerUpdateBefore($params)
978979 {
979980 $ customer = new Customer ($ params ['object ' ]->id );
980981 $ this ->_origin_newsletter = (int ) $ customer ->newsletter ;
982+
983+ Db::getInstance ()->execute ('DELETE FROM ' . _DB_PREFIX_ . 'emailsubscription WHERE id_shop= ' . (int ) $ params ['object ' ]->id_shop . ' AND email= \'' . pSQL ($ params ['object ' ]->email ) . "' " );
981984 }
982985
983986 public function hookActionCustomerAccountUpdate ($ params )
You can’t perform that action at this time.
0 commit comments