Magento 1.9 – Frontend Customer Registration Newsletter Not Subscribing

magento-1.9newsletter

I have issue with newsletter subscription on customer registration process. even i have select "Sign Up for Newsletter" checkbox on registration form.

I got user confirm email but didn't get confirm massage on newsletter as well as newsletter subscription not successful. And not even mention i have subscribe to newsletter. But After I login to account then select newsletter subscription is shows unchecked checkbox. if I checked that and save, I got email to confirm newsletter subscription.

In Back-end I have set "Allow Guest Subscription" and "Need to Confirm" to "Yes"

So anyone have idea about that. Thanks

Best Answer

When you look at

app/code/core/Mage/Newsletter/Model/Subscriber.php

public function confirm($code)
{
    if($this->getCode()==$code) {
        $this->setStatus(self::STATUS_SUBSCRIBED)
            ->setIsStatusChanged(true)
            ->save();
        return true;
    }

    return false;
}

in this method if confimration code match then it just return true nothing else

If you want to send newsletter subscription success email after confirmation then you have to modify above code with just one line

$this->sendConfirmationSuccessEmail();

But make sure that you you are overwrite core file,,so your final code should be in

app/code/local/Mage/Newsletter/Model/Subscriber.php

public function confirm($code)
{
    if($this->getCode()==$code) {
        $this->setStatus(self::STATUS_SUBSCRIBED)
            ->setIsStatusChanged(true)
            ->save();
        // We are just adding below line 
        $this->sendConfirmationSuccessEmail(); // custom line
        return true;
    }

    return false;
}
Related Topic