Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport] Fix newsletter subscription behaviour for registered customer. #17179

Merged
merged 3 commits into from
Aug 2, 2018
Merged

[Backport] Fix newsletter subscription behaviour for registered customer. #17179

merged 3 commits into from
Aug 2, 2018

Conversation

mage2pratik
Copy link
Contributor

Original Pull Request

#15479
This Pull Request fix newsletter subscription behaviour for registered customer.

Registered customer can subscribe to newsletter from 2 places:

  1. From newsletter list in my account.
  2. From newsletter block form.

If set Magento Admin->Stores->Configuration->Customers->Newsletter->"Need to Confirm" to "yes" subscribe to newsletter from My Account require customer confirmation, but from newsletter block confirmation not required and registered customer will be subscribed to newsletter.

We expect that in both cases behaviour will be the same: customer must confirm subscribe to newsletter action. (It also compliance with new GDPR).

Backend background:
issue with different behaviour is come because subscribe from My Account and subscribe from newsletter block use different methods with different logic.

Subscribe to newsletter from MyAccount use \Magento\Newsletter\Model\Subscriber::_updateCustomerSubscription($customerId, $subscribe)

Subscribe to newsletter from newsletter block use \Magento\Newsletter\Model\Subscriber::subscribe($email)
subscribe($email) have row which checking if email for subscribe the same as customer email
$isSubscribeOwnEmail = $this->_customerSession->isLoggedIn() && $this->_customerSession->getCustomerDataObject()->getEmail() == $email;
and if NeedToConfirm is active:
customer will be subscribed to newsletter without confirmation if $isSubscribeOwnEmail =true
or
customer must confirm email when $isSubscribeOwnEmail =false
Instead of subscribe($email) method _updateCustomerSubscription($customerId, $subscribe) doesn't have this check $isSubscribeOwnEmail and in any case require confirmation if NeedToConfirm is active.

PR fix remove $isSubscribeOwnEmail var from subscribe($email) method and behaviour will be the same in both cases for subscribe to newsletter action: from MyAccount and from newsletter block.

@magento-engcom-team
Copy link
Contributor

Hi @mage2pratik. Thank you for your contribution.
We will aim to release these changes as part of 2.1.15.
Please check the release notes for final confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants