I'm writing a small plugin that intercepts the Subscriber
class (Magento\Newsletter\Model\Subscriber
), fetches the subscriber email address/id and pushes it further to our api.
This works well when the 'Need to Confirm' option is set to 'No'. However, when I enable the double opt-in and the confirmation email is sent and clicked, Magento completely ignores the 'SubscriberPlugin' file, even though it still actually uses the main, original class 'Subscriber' (proved by placing error_log(FILE) in the original class file).
I know that when a user clicks the confirmation link, the method triggered in the Subscriber
class is confirm
. With that knowledge I've added a new method afterConfirm
to the SubscriberPlugin
file, but that for now will do nothing, as like mentioned above, Magento is ignoring the plugin file when a user confirms subscription.
Any ideas?