File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
app/code/Magento/Newsletter/Controller/Subscriber Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -121,6 +121,15 @@ public function execute()
121
121
$ this ->validateGuestSubscription ();
122
122
$ this ->validateEmailAvailable ($ email );
123
123
124
+ $ subscriber = $ this ->_subscriberFactory ->create ()->loadByEmail ($ email );
125
+ if ($ subscriber ->getId ()
126
+ && $ subscriber ->getSubscriberStatus () == \Magento \Newsletter \Model \Subscriber::STATUS_SUBSCRIBED
127
+ ) {
128
+ throw new \Magento \Framework \Exception \LocalizedException (
129
+ __ ('This email address is already subscribed. ' )
130
+ );
131
+ }
132
+
124
133
$ status = $ this ->_subscriberFactory ->create ()->subscribe ($ email );
125
134
if ($ status == \Magento \Newsletter \Model \Subscriber::STATUS_NOT_ACTIVE ) {
126
135
$ this ->messageManager ->addSuccess (__ ('The confirmation request has been sent. ' ));
You can’t perform that action at this time.
0 commit comments