Use Factory,
Magento\Newsletter\Model\SubscriberFactory
Using isSubscribed() method. You can check the user is a subscriber to the newsletter or not.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
<?php namespace Magemonkey\Subscriber\Model; use Magento\Framework\Exception\LocalizedException; use Magento\Newsletter\Model\SubscriberFactory; class IsSubscribed { /** * @var SubscriberFactory */ private $subscriberFactory; /** * @param SubscriberFactory $subscriberFactory */ public function __construct( SubscriberFactory $subscriberFactory ) { $this->subscriberFactory = $subscriberFactory; } /** * @param int $customerId * @return bool */ public function isCustomerSubscribeById($customerId) { $status = $this->subscriberFactory->create()->loadByCustomerId((int)$customerId)->isSubscribed(); return (bool)$status; } /** * @param string $email * @return bool */ public function isCustomerSubscribeByEmail($email) { $status = $this->subscriberFactory->create()->loadByEmail($email)->isSubscribed(); return (bool)$status; } } |
If you want get query string params in controller file,...
Create di.xml and add the below code Magemonkey/Redirect/etc/frontend/di.xml [crayon-628462656d500961651147/] Create...
You can try below code to change local date to...
Step 1: First you need to add registration.php file in...
Step1 : Override message.js in current theme file on the...