I use this code to set the subscription status:
const STATUS_SUBSCRIBED = 1; const STATUS_NOT_ACTIVE = 2; const STATUS_UNSUBSCRIBED = 3; const STATUS_UNCONFIRMED = 4; ... $customer = Mage::getSingleton('customer/session')->getCustomer(); $customerID = $customer->getId(); $customerModel = Mage::getModel('customer/customer') ->setWebsiteId(Mage::app()->getStore()->getWebsiteId()) ->load($customerID); Mage::getModel('newsletter/subscriber') ->setCustomerId($customerModel->getId()) ->setStatus(self::STATUS_SUBSCRIBED) ->setEmail("email@example.com") ->save();
But the state is not saved and the checkbox* is not getting set in the backend. What am I doing wrong?
*the checkbox I talk about is at: Customers -> manage customers -> 'enter a customer account' -> Newsletter