Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

How to check Newsletter subscribe? 
 
MyAgency
Jr. Member
 
Total Posts:  11
Joined:  2010-08-26
 

Hey Magento-Users,

i will create a module for newsletter subscribe where the user is getting a voucher code with discount. i’ve createt an event Observer for newsletter_subscriber_save_before, but there is one problem:

1. User subscribe for newsletter -> sending confirmation mail -> user clicks on the Link -> Observer sends out a email with voucher code
2. User is allready in newsletter -> subscibe again -> Magento sends confirmation link again ->observer sende again out the email with the voucher code.

How i can check if your allready are in the newsletter?

here ist my code:

public function sendVoucherCode(Varien_Event_Observer $observer)
    
{
        
//Get subscriber model
        
$subscriber $observer->getEvent()->getSubscriber();

        
//Check if is subscribed
        
if($subscriber->isSubscribed()) 
           $this
->createVoucherCodeAndSendMail($subscriber->getEmail());
        
}
    }

sorry for my bad english!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top