Version Notes
Bugfixing Release
Download this release
Release Info
| Developer | Mathis Klooss |
| Extension | Loewenstark_Newsletter |
| Version | 1.5.0.3 |
| Comparing to | |
| See all releases | |
Code changes from version 1.5.0.2 to 1.5.0.3
- app/code/community/Loewenstark/Newsletter/Block/Resendrequest.php +9 -11
- app/code/community/Loewenstark/Newsletter/Block/Unsubscriber.php +1 -3
- app/code/community/Loewenstark/Newsletter/Helper/Data.php +1 -2
- app/code/community/Loewenstark/Newsletter/Model/Subscriber.php +33 -27
- app/code/community/Loewenstark/Newsletter/Model/Unsubscriber.php +4 -5
- app/code/community/Loewenstark/Newsletter/controllers/ManageController.php +6 -4
- app/code/community/Loewenstark/Newsletter/controllers/SubscriberController.php +6 -11
- app/code/community/Loewenstark/Newsletter/controllers/UnsubscriberController.php +6 -6
- app/design/frontend/base/default/template/newsletter/manage/resend.phtml +14 -1
- app/locale/de_DE/Loewenstark_Newsletter.csv +2 -1
- app/locale/en_US/Loewenstark_Newsletter.csv +2 -1
- package.xml +6 -6
app/code/community/Loewenstark/Newsletter/Block/Resendrequest.php
CHANGED
|
@@ -8,10 +8,8 @@
|
|
| 8 |
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 9 |
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 10 |
*/
|
| 11 |
-
class Loewenstark_Newsletter_Block_Resendrequest
|
| 12 |
-
extends Mage_Customer_Block_Account_Dashboard
|
| 13 |
{
|
| 14 |
-
|
| 15 |
/**
|
| 16 |
* get resend url
|
| 17 |
*
|
|
@@ -21,39 +19,39 @@ extends Mage_Customer_Block_Account_Dashboard
|
|
| 21 |
{
|
| 22 |
return $this->getUrl('*/*/resend', array('_secure' => true));
|
| 23 |
}
|
| 24 |
-
|
| 25 |
/**
|
| 26 |
* Type is Enabled
|
| 27 |
-
*
|
| 28 |
* @return type
|
| 29 |
*/
|
| 30 |
public function isEnabled()
|
| 31 |
{
|
| 32 |
return !Mage::getStoreConfigFlag(Loewenstark_Newsletter_Model_Subscriber::XML_PATH_ADVANCED_DOUBELOPTIN);
|
| 33 |
}
|
| 34 |
-
|
| 35 |
/**
|
| 36 |
-
* get Current
|
| 37 |
* @return type
|
| 38 |
*/
|
| 39 |
public function getStatus()
|
| 40 |
{
|
| 41 |
return (int) $this->getSubscriptionObject()->getStatus();
|
| 42 |
}
|
| 43 |
-
|
| 44 |
/**
|
| 45 |
* Subscriber Model
|
| 46 |
-
*
|
| 47 |
* @return Loewenstark_Newsletter_SubscriberController
|
| 48 |
*/
|
| 49 |
public function getSubscription()
|
| 50 |
{
|
| 51 |
return $this->getSubscriptionObject();
|
| 52 |
}
|
| 53 |
-
|
| 54 |
/**
|
| 55 |
* Simple Mapping
|
| 56 |
-
*
|
| 57 |
* @param type $string
|
| 58 |
* @return type
|
| 59 |
*/
|
| 8 |
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 9 |
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 10 |
*/
|
| 11 |
+
class Loewenstark_Newsletter_Block_Resendrequest extends Mage_Customer_Block_Account_Dashboard
|
|
|
|
| 12 |
{
|
|
|
|
| 13 |
/**
|
| 14 |
* get resend url
|
| 15 |
*
|
| 19 |
{
|
| 20 |
return $this->getUrl('*/*/resend', array('_secure' => true));
|
| 21 |
}
|
| 22 |
+
|
| 23 |
/**
|
| 24 |
* Type is Enabled
|
| 25 |
+
*
|
| 26 |
* @return type
|
| 27 |
*/
|
| 28 |
public function isEnabled()
|
| 29 |
{
|
| 30 |
return !Mage::getStoreConfigFlag(Loewenstark_Newsletter_Model_Subscriber::XML_PATH_ADVANCED_DOUBELOPTIN);
|
| 31 |
}
|
| 32 |
+
|
| 33 |
/**
|
| 34 |
+
* get Current
|
| 35 |
* @return type
|
| 36 |
*/
|
| 37 |
public function getStatus()
|
| 38 |
{
|
| 39 |
return (int) $this->getSubscriptionObject()->getStatus();
|
| 40 |
}
|
| 41 |
+
|
| 42 |
/**
|
| 43 |
* Subscriber Model
|
| 44 |
+
*
|
| 45 |
* @return Loewenstark_Newsletter_SubscriberController
|
| 46 |
*/
|
| 47 |
public function getSubscription()
|
| 48 |
{
|
| 49 |
return $this->getSubscriptionObject();
|
| 50 |
}
|
| 51 |
+
|
| 52 |
/**
|
| 53 |
* Simple Mapping
|
| 54 |
+
*
|
| 55 |
* @param type $string
|
| 56 |
* @return type
|
| 57 |
*/
|
app/code/community/Loewenstark/Newsletter/Block/Unsubscriber.php
CHANGED
|
@@ -8,10 +8,8 @@
|
|
| 8 |
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 9 |
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 10 |
*/
|
| 11 |
-
class Loewenstark_Newsletter_Block_Unsubscriber
|
| 12 |
-
extends Mage_Newsletter_Block_Subscribe
|
| 13 |
{
|
| 14 |
-
|
| 15 |
/**
|
| 16 |
* Retrieve form action url and set "secure" param to avoid confirm
|
| 17 |
* message when we submit form from secure page to unsecure
|
| 8 |
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 9 |
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 10 |
*/
|
| 11 |
+
class Loewenstark_Newsletter_Block_Unsubscriber extends Mage_Newsletter_Block_Subscribe
|
|
|
|
| 12 |
{
|
|
|
|
| 13 |
/**
|
| 14 |
* Retrieve form action url and set "secure" param to avoid confirm
|
| 15 |
* message when we submit form from secure page to unsecure
|
app/code/community/Loewenstark/Newsletter/Helper/Data.php
CHANGED
|
@@ -8,7 +8,6 @@
|
|
| 8 |
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 9 |
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 10 |
*/
|
| 11 |
-
class Loewenstark_Newsletter_Helper_Data
|
| 12 |
-
extends Mage_Newsletter_Helper_Data
|
| 13 |
{
|
| 14 |
}
|
| 8 |
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 9 |
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 10 |
*/
|
| 11 |
+
class Loewenstark_Newsletter_Helper_Data extends Mage_Newsletter_Helper_Data
|
|
|
|
| 12 |
{
|
| 13 |
}
|
app/code/community/Loewenstark/Newsletter/Model/Subscriber.php
CHANGED
|
@@ -8,17 +8,16 @@
|
|
| 8 |
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 9 |
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 10 |
*/
|
| 11 |
-
class Loewenstark_Newsletter_Model_Subscriber
|
| 12 |
-
extends Mage_Newsletter_Model_Subscriber
|
| 13 |
{
|
| 14 |
// configuration
|
| 15 |
-
|
| 16 |
-
|
| 17 |
/** @var bool $_sendConfirmationSuccessEmail check if email already send **/
|
| 18 |
protected $_sendConfirmationSuccessEmail = true;
|
| 19 |
/** @var bool $_sendConfirmationRequestEmail check if email already send **/
|
| 20 |
protected $_sendConfirmationRequestEmail = true;
|
| 21 |
-
|
| 22 |
/**
|
| 23 |
* Subscribes by email
|
| 24 |
*
|
|
@@ -29,15 +28,14 @@ extends Mage_Newsletter_Model_Subscriber
|
|
| 29 |
public function subscribe($email)
|
| 30 |
{
|
| 31 |
// fall back to default
|
| 32 |
-
if(Mage::getStoreConfigFlag(self::XML_PATH_ADVANCED_DOUBELOPTIN))
|
| 33 |
-
{
|
| 34 |
return parent::subscribe($email);
|
| 35 |
}
|
| 36 |
-
|
| 37 |
$this->loadByEmail($email);
|
| 38 |
$customerSession = Mage::getSingleton('customer/session');
|
| 39 |
|
| 40 |
-
if(!$this->getId()) {
|
| 41 |
$this->setSubscriberConfirmCode($this->randomSequence());
|
| 42 |
}
|
| 43 |
|
|
@@ -87,7 +85,7 @@ extends Mage_Newsletter_Model_Subscriber
|
|
| 87 |
throw new Exception($e->getMessage());
|
| 88 |
}
|
| 89 |
}
|
| 90 |
-
|
| 91 |
/**
|
| 92 |
* Saving customer subscription status
|
| 93 |
*
|
|
@@ -97,11 +95,10 @@ extends Mage_Newsletter_Model_Subscriber
|
|
| 97 |
public function subscribeCustomer($customer)
|
| 98 |
{
|
| 99 |
// fall back to default
|
| 100 |
-
if(Mage::getStoreConfigFlag(self::XML_PATH_ADVANCED_DOUBELOPTIN))
|
| 101 |
-
{
|
| 102 |
return parent::subscribeCustomer($customer);
|
| 103 |
}
|
| 104 |
-
|
| 105 |
$this->loadByCustomer($customer);
|
| 106 |
|
| 107 |
if ($customer->getImportMode()) {
|
|
@@ -114,7 +111,7 @@ extends Mage_Newsletter_Model_Subscriber
|
|
| 114 |
return $this;
|
| 115 |
}
|
| 116 |
|
| 117 |
-
if(!$this->getId()) {
|
| 118 |
$this->setSubscriberConfirmCode($this->randomSequence());
|
| 119 |
}
|
| 120 |
|
|
@@ -132,9 +129,17 @@ extends Mage_Newsletter_Model_Subscriber
|
|
| 132 |
/**
|
| 133 |
* If subscription status has been changed then send email to the customer
|
| 134 |
*/
|
| 135 |
-
if($status == self::STATUS_UNCONFIRMED) {
|
| 136 |
$sendInformationEmail = true;
|
| 137 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
} elseif (($this->getStatus() == self::STATUS_UNCONFIRMED) && (is_null($confirmation))) {
|
| 139 |
$status = self::STATUS_UNCONFIRMED;
|
| 140 |
$sendInformationEmail = true;
|
|
@@ -142,13 +147,13 @@ extends Mage_Newsletter_Model_Subscriber
|
|
| 142 |
$status = ($this->getStatus() == self::STATUS_NOT_ACTIVE ? self::STATUS_UNSUBSCRIBED : $this->getStatus());
|
| 143 |
}
|
| 144 |
|
| 145 |
-
if($status != $this->getStatus()) {
|
| 146 |
$this->setIsStatusChanged(true);
|
| 147 |
}
|
| 148 |
|
| 149 |
$this->setStatus($status);
|
| 150 |
|
| 151 |
-
if(!$this->getId()) {
|
| 152 |
$storeId = $customer->getStoreId();
|
| 153 |
if ($customer->getStoreId() == 0) {
|
| 154 |
$storeId = Mage::app()->getWebsite($customer->getWebsiteId())->getDefaultStore()->getId();
|
|
@@ -162,8 +167,7 @@ extends Mage_Newsletter_Model_Subscriber
|
|
| 162 |
}
|
| 163 |
|
| 164 |
$this->save();
|
| 165 |
-
if($this->getIsStatusChanged())
|
| 166 |
-
{
|
| 167 |
$sendSubscription = $customer->getData('sendSubscription') || $sendInformationEmail;
|
| 168 |
if (is_null($sendSubscription) xor $sendSubscription) {
|
| 169 |
if ($this->getIsStatusChanged() && $status == self::STATUS_UNSUBSCRIBED) {
|
|
@@ -177,7 +181,7 @@ extends Mage_Newsletter_Model_Subscriber
|
|
| 177 |
}
|
| 178 |
return $this;
|
| 179 |
}
|
| 180 |
-
|
| 181 |
/**
|
| 182 |
* Confirms subscriber newsletter
|
| 183 |
*
|
|
@@ -187,7 +191,7 @@ extends Mage_Newsletter_Model_Subscriber
|
|
| 187 |
public function confirm($code)
|
| 188 |
{
|
| 189 |
$parent = (bool) parent::confirm($code);
|
| 190 |
-
if(
|
| 191 |
$this->sendConfirmationSuccessEmail();
|
| 192 |
return true;
|
| 193 |
}
|
|
@@ -196,22 +200,24 @@ extends Mage_Newsletter_Model_Subscriber
|
|
| 196 |
|
| 197 |
/**
|
| 198 |
* Sends out confirmation success email
|
| 199 |
-
*
|
| 200 |
* @see Mage_Newsletter_Model_Subscriber::sendConfirmationSuccessEmail
|
| 201 |
*
|
| 202 |
* @return Mage_Newsletter_Model_Subscriber
|
| 203 |
*/
|
| 204 |
-
public function sendConfirmationSuccessEmail()
|
|
|
|
| 205 |
// do not send two E-Mails, may Magento will be implements this line in methode self::confirm($code)
|
| 206 |
-
if(
|
| 207 |
parent::sendConfirmationSuccessEmail();
|
| 208 |
$this->_sendConfirmationSuccessEmail = !$this->_sendConfirmationSuccessEmail;
|
| 209 |
}
|
| 210 |
return $this;
|
| 211 |
}
|
| 212 |
-
|
| 213 |
-
public function sendConfirmationRequestEmail()
|
| 214 |
-
|
|
|
|
| 215 |
parent::sendConfirmationRequestEmail();
|
| 216 |
$this->_sendConfirmationRequestEmail = !$this->_sendConfirmationRequestEmail;
|
| 217 |
}
|
| 8 |
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 9 |
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 10 |
*/
|
| 11 |
+
class Loewenstark_Newsletter_Model_Subscriber extends Mage_Newsletter_Model_Subscriber
|
|
|
|
| 12 |
{
|
| 13 |
// configuration
|
| 14 |
+
const XML_PATH_ADVANCED_DOUBELOPTIN = "newsletter/advanced/doubleoptinmagedefault";
|
| 15 |
+
|
| 16 |
/** @var bool $_sendConfirmationSuccessEmail check if email already send **/
|
| 17 |
protected $_sendConfirmationSuccessEmail = true;
|
| 18 |
/** @var bool $_sendConfirmationRequestEmail check if email already send **/
|
| 19 |
protected $_sendConfirmationRequestEmail = true;
|
| 20 |
+
|
| 21 |
/**
|
| 22 |
* Subscribes by email
|
| 23 |
*
|
| 28 |
public function subscribe($email)
|
| 29 |
{
|
| 30 |
// fall back to default
|
| 31 |
+
if (Mage::getStoreConfigFlag(self::XML_PATH_ADVANCED_DOUBELOPTIN)) {
|
|
|
|
| 32 |
return parent::subscribe($email);
|
| 33 |
}
|
| 34 |
+
|
| 35 |
$this->loadByEmail($email);
|
| 36 |
$customerSession = Mage::getSingleton('customer/session');
|
| 37 |
|
| 38 |
+
if (!$this->getId()) {
|
| 39 |
$this->setSubscriberConfirmCode($this->randomSequence());
|
| 40 |
}
|
| 41 |
|
| 85 |
throw new Exception($e->getMessage());
|
| 86 |
}
|
| 87 |
}
|
| 88 |
+
|
| 89 |
/**
|
| 90 |
* Saving customer subscription status
|
| 91 |
*
|
| 95 |
public function subscribeCustomer($customer)
|
| 96 |
{
|
| 97 |
// fall back to default
|
| 98 |
+
if (Mage::getStoreConfigFlag(self::XML_PATH_ADVANCED_DOUBELOPTIN)) {
|
|
|
|
| 99 |
return parent::subscribeCustomer($customer);
|
| 100 |
}
|
| 101 |
+
|
| 102 |
$this->loadByCustomer($customer);
|
| 103 |
|
| 104 |
if ($customer->getImportMode()) {
|
| 111 |
return $this;
|
| 112 |
}
|
| 113 |
|
| 114 |
+
if (!$this->getId()) {
|
| 115 |
$this->setSubscriberConfirmCode($this->randomSequence());
|
| 116 |
}
|
| 117 |
|
| 129 |
/**
|
| 130 |
* If subscription status has been changed then send email to the customer
|
| 131 |
*/
|
| 132 |
+
if ($status == self::STATUS_UNCONFIRMED) {
|
| 133 |
$sendInformationEmail = true;
|
| 134 |
}
|
| 135 |
+
/**
|
| 136 |
+
* reset with data from subscription
|
| 137 |
+
*/
|
| 138 |
+
if ($status == self::STATUS_UNCONFIRMED && $this->getStatus() == self::STATUS_SUBSCRIBED)
|
| 139 |
+
{
|
| 140 |
+
$status = self::STATUS_SUBSCRIBED;
|
| 141 |
+
$sendInformationEmail = false;
|
| 142 |
+
}
|
| 143 |
} elseif (($this->getStatus() == self::STATUS_UNCONFIRMED) && (is_null($confirmation))) {
|
| 144 |
$status = self::STATUS_UNCONFIRMED;
|
| 145 |
$sendInformationEmail = true;
|
| 147 |
$status = ($this->getStatus() == self::STATUS_NOT_ACTIVE ? self::STATUS_UNSUBSCRIBED : $this->getStatus());
|
| 148 |
}
|
| 149 |
|
| 150 |
+
if ($status != $this->getStatus()) {
|
| 151 |
$this->setIsStatusChanged(true);
|
| 152 |
}
|
| 153 |
|
| 154 |
$this->setStatus($status);
|
| 155 |
|
| 156 |
+
if (!$this->getId()) {
|
| 157 |
$storeId = $customer->getStoreId();
|
| 158 |
if ($customer->getStoreId() == 0) {
|
| 159 |
$storeId = Mage::app()->getWebsite($customer->getWebsiteId())->getDefaultStore()->getId();
|
| 167 |
}
|
| 168 |
|
| 169 |
$this->save();
|
| 170 |
+
if ($this->getIsStatusChanged()) {
|
|
|
|
| 171 |
$sendSubscription = $customer->getData('sendSubscription') || $sendInformationEmail;
|
| 172 |
if (is_null($sendSubscription) xor $sendSubscription) {
|
| 173 |
if ($this->getIsStatusChanged() && $status == self::STATUS_UNSUBSCRIBED) {
|
| 181 |
}
|
| 182 |
return $this;
|
| 183 |
}
|
| 184 |
+
|
| 185 |
/**
|
| 186 |
* Confirms subscriber newsletter
|
| 187 |
*
|
| 191 |
public function confirm($code)
|
| 192 |
{
|
| 193 |
$parent = (bool) parent::confirm($code);
|
| 194 |
+
if ($parent) {
|
| 195 |
$this->sendConfirmationSuccessEmail();
|
| 196 |
return true;
|
| 197 |
}
|
| 200 |
|
| 201 |
/**
|
| 202 |
* Sends out confirmation success email
|
| 203 |
+
*
|
| 204 |
* @see Mage_Newsletter_Model_Subscriber::sendConfirmationSuccessEmail
|
| 205 |
*
|
| 206 |
* @return Mage_Newsletter_Model_Subscriber
|
| 207 |
*/
|
| 208 |
+
public function sendConfirmationSuccessEmail()
|
| 209 |
+
{
|
| 210 |
// do not send two E-Mails, may Magento will be implements this line in methode self::confirm($code)
|
| 211 |
+
if ($this->_sendConfirmationSuccessEmail) {
|
| 212 |
parent::sendConfirmationSuccessEmail();
|
| 213 |
$this->_sendConfirmationSuccessEmail = !$this->_sendConfirmationSuccessEmail;
|
| 214 |
}
|
| 215 |
return $this;
|
| 216 |
}
|
| 217 |
+
|
| 218 |
+
public function sendConfirmationRequestEmail()
|
| 219 |
+
{
|
| 220 |
+
if ($this->_sendConfirmationRequestEmail) {
|
| 221 |
parent::sendConfirmationRequestEmail();
|
| 222 |
$this->_sendConfirmationRequestEmail = !$this->_sendConfirmationRequestEmail;
|
| 223 |
}
|
app/code/community/Loewenstark/Newsletter/Model/Unsubscriber.php
CHANGED
|
@@ -8,10 +8,8 @@
|
|
| 8 |
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 9 |
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 10 |
*/
|
| 11 |
-
class Loewenstark_Newsletter_Model_Unsubscriber
|
| 12 |
-
extends Loewenstark_Newsletter_Model_Subscriber
|
| 13 |
{
|
| 14 |
-
|
| 15 |
/**
|
| 16 |
* unsubscribes by email
|
| 17 |
*
|
|
@@ -19,10 +17,11 @@ extends Loewenstark_Newsletter_Model_Subscriber
|
|
| 19 |
* @throws Exception
|
| 20 |
* @return int
|
| 21 |
*/
|
| 22 |
-
public function unsubscribeByEmail($email)
|
|
|
|
| 23 |
$this->setStoreId(Mage::app()->getStore()->getId());
|
| 24 |
$this->loadByEmail($email);
|
| 25 |
-
if(
|
| 26 |
return false;
|
| 27 |
}
|
| 28 |
$this->setCheckCode($this->getCode());
|
| 8 |
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 9 |
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 10 |
*/
|
| 11 |
+
class Loewenstark_Newsletter_Model_Unsubscriber extends Loewenstark_Newsletter_Model_Subscriber
|
|
|
|
| 12 |
{
|
|
|
|
| 13 |
/**
|
| 14 |
* unsubscribes by email
|
| 15 |
*
|
| 17 |
* @throws Exception
|
| 18 |
* @return int
|
| 19 |
*/
|
| 20 |
+
public function unsubscribeByEmail($email)
|
| 21 |
+
{
|
| 22 |
$this->setStoreId(Mage::app()->getStore()->getId());
|
| 23 |
$this->loadByEmail($email);
|
| 24 |
+
if (!$this->getId()) {
|
| 25 |
return false;
|
| 26 |
}
|
| 27 |
$this->setCheckCode($this->getCode());
|
app/code/community/Loewenstark/Newsletter/controllers/ManageController.php
CHANGED
|
@@ -8,19 +8,21 @@
|
|
| 8 |
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 9 |
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 10 |
*/
|
| 11 |
-
class Loewenstark_Newsletter_ManageController
|
| 12 |
-
extends Mage_Core_Controller_Front_Action
|
| 13 |
{
|
| 14 |
/**
|
| 15 |
* New subscription action
|
| 16 |
*/
|
| 17 |
public function resendAction()
|
| 18 |
{
|
| 19 |
-
if(Mage::helper('customer')->isLoggedIn()) {
|
| 20 |
try {
|
| 21 |
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
| 22 |
Mage::getModel('newsletter/subscriber')->loadByCustomer($customer)->sendConfirmationRequestEmail();
|
| 23 |
-
} catch(Exception $e) {
|
|
|
|
|
|
|
|
|
|
| 24 |
Mage::getSingleton('core/session')->addSuccess(Mage::helper('lws_newsletter')->__('Newsletter confirmation E-Mail has been send!'));
|
| 25 |
}
|
| 26 |
$this->_redirectReferer();
|
| 8 |
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 9 |
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 10 |
*/
|
| 11 |
+
class Loewenstark_Newsletter_ManageController extends Mage_Core_Controller_Front_Action
|
|
|
|
| 12 |
{
|
| 13 |
/**
|
| 14 |
* New subscription action
|
| 15 |
*/
|
| 16 |
public function resendAction()
|
| 17 |
{
|
| 18 |
+
if (Mage::helper('customer')->isLoggedIn()) {
|
| 19 |
try {
|
| 20 |
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
| 21 |
Mage::getModel('newsletter/subscriber')->loadByCustomer($customer)->sendConfirmationRequestEmail();
|
| 22 |
+
} catch (Exception $e) {
|
| 23 |
+
// Log exception
|
| 24 |
+
Mage::logException($e);
|
| 25 |
+
}
|
| 26 |
Mage::getSingleton('core/session')->addSuccess(Mage::helper('lws_newsletter')->__('Newsletter confirmation E-Mail has been send!'));
|
| 27 |
}
|
| 28 |
$this->_redirectReferer();
|
app/code/community/Loewenstark/Newsletter/controllers/SubscriberController.php
CHANGED
|
@@ -8,8 +8,7 @@
|
|
| 8 |
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 9 |
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 10 |
*/
|
| 11 |
-
class Loewenstark_Newsletter_SubscriberController
|
| 12 |
-
extends Mage_Core_Controller_Front_Action
|
| 13 |
{
|
| 14 |
/**
|
| 15 |
* New subscription action
|
|
@@ -27,13 +26,12 @@ extends Mage_Core_Controller_Front_Action
|
|
| 27 |
Mage::throwException($helper->__('Please enter a valid email address.'));
|
| 28 |
}
|
| 29 |
|
| 30 |
-
if (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_ALLOW_GUEST_SUBSCRIBE_FLAG) != 1 &&
|
| 31 |
!$customerSession->isLoggedIn()) {
|
| 32 |
Mage::throwException($helper->__('Sorry, but administrator denied subscription for guests. Please <a href="%s">register</a>.', Mage::helper('customer')->getRegisterUrl()));
|
| 33 |
}
|
| 34 |
|
| 35 |
-
if(Mage::getStoreConfigFlag(Loewenstark_Newsletter_Model_Subscriber::XML_PATH_ADVANCED_DOUBELOPTIN))
|
| 36 |
-
{
|
| 37 |
$ownerId = Mage::getModel('customer/customer')
|
| 38 |
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
|
| 39 |
->loadByEmail($email)
|
|
@@ -46,15 +44,12 @@ extends Mage_Core_Controller_Front_Action
|
|
| 46 |
$status = Mage::getModel('newsletter/subscriber')->subscribe($email);
|
| 47 |
if ($status == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE) {
|
| 48 |
$session->addSuccess($helper->__('Confirmation request has been sent.'));
|
| 49 |
-
}
|
| 50 |
-
else {
|
| 51 |
$session->addSuccess($helper->__('Thank you for your subscription.'));
|
| 52 |
}
|
| 53 |
-
}
|
| 54 |
-
catch (Mage_Core_Exception $e) {
|
| 55 |
$session->addException($e, $helper->__('There was a problem with the subscription: %s', $e->getMessage()));
|
| 56 |
-
}
|
| 57 |
-
catch (Exception $e) {
|
| 58 |
$session->addException($e, $helper->__('There was a problem with the subscription.'));
|
| 59 |
}
|
| 60 |
}
|
| 8 |
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 9 |
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 10 |
*/
|
| 11 |
+
class Loewenstark_Newsletter_SubscriberController extends Mage_Core_Controller_Front_Action
|
|
|
|
| 12 |
{
|
| 13 |
/**
|
| 14 |
* New subscription action
|
| 26 |
Mage::throwException($helper->__('Please enter a valid email address.'));
|
| 27 |
}
|
| 28 |
|
| 29 |
+
if (Mage::getStoreConfig(Mage_Newsletter_Model_Subscriber::XML_PATH_ALLOW_GUEST_SUBSCRIBE_FLAG) != 1 &&
|
| 30 |
!$customerSession->isLoggedIn()) {
|
| 31 |
Mage::throwException($helper->__('Sorry, but administrator denied subscription for guests. Please <a href="%s">register</a>.', Mage::helper('customer')->getRegisterUrl()));
|
| 32 |
}
|
| 33 |
|
| 34 |
+
if (Mage::getStoreConfigFlag(Loewenstark_Newsletter_Model_Subscriber::XML_PATH_ADVANCED_DOUBELOPTIN)) {
|
|
|
|
| 35 |
$ownerId = Mage::getModel('customer/customer')
|
| 36 |
->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
|
| 37 |
->loadByEmail($email)
|
| 44 |
$status = Mage::getModel('newsletter/subscriber')->subscribe($email);
|
| 45 |
if ($status == Mage_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE) {
|
| 46 |
$session->addSuccess($helper->__('Confirmation request has been sent.'));
|
| 47 |
+
} else {
|
|
|
|
| 48 |
$session->addSuccess($helper->__('Thank you for your subscription.'));
|
| 49 |
}
|
| 50 |
+
} catch (Mage_Core_Exception $e) {
|
|
|
|
| 51 |
$session->addException($e, $helper->__('There was a problem with the subscription: %s', $e->getMessage()));
|
| 52 |
+
} catch (Exception $e) {
|
|
|
|
| 53 |
$session->addException($e, $helper->__('There was a problem with the subscription.'));
|
| 54 |
}
|
| 55 |
}
|
app/code/community/Loewenstark/Newsletter/controllers/UnsubscriberController.php
CHANGED
|
@@ -8,9 +8,11 @@
|
|
| 8 |
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 9 |
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 10 |
*/
|
| 11 |
-
class Loewenstark_Newsletter_UnsubscriberController
|
| 12 |
-
extends Mage_Core_Controller_Front_Action
|
| 13 |
{
|
|
|
|
|
|
|
|
|
|
| 14 |
public function indexAction()
|
| 15 |
{
|
| 16 |
if ($this->getRequest()->isPost() && $this->getRequest()->getPost('email')) {
|
|
@@ -24,11 +26,9 @@ extends Mage_Core_Controller_Front_Action
|
|
| 24 |
|
| 25 |
$status = Mage::getModel('newsletter/unsubscriber')->unsubscribeByEmail($email);
|
| 26 |
$session->addSuccess($this->__('You have been unsubscribed.'));
|
| 27 |
-
}
|
| 28 |
-
catch (Mage_Core_Exception $e) {
|
| 29 |
$session->addException($e, $this->__('There was a problem with the unsubscription: %s', $e->getMessage()));
|
| 30 |
-
}
|
| 31 |
-
catch (Exception $e) {
|
| 32 |
$session->addException($e, $this->__('There was a problem with the unsubscription.'));
|
| 33 |
}
|
| 34 |
}
|
| 8 |
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 9 |
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 10 |
*/
|
| 11 |
+
class Loewenstark_Newsletter_UnsubscriberController extends Mage_Core_Controller_Front_Action
|
|
|
|
| 12 |
{
|
| 13 |
+
/**
|
| 14 |
+
*
|
| 15 |
+
*/
|
| 16 |
public function indexAction()
|
| 17 |
{
|
| 18 |
if ($this->getRequest()->isPost() && $this->getRequest()->getPost('email')) {
|
| 26 |
|
| 27 |
$status = Mage::getModel('newsletter/unsubscriber')->unsubscribeByEmail($email);
|
| 28 |
$session->addSuccess($this->__('You have been unsubscribed.'));
|
| 29 |
+
} catch (Mage_Core_Exception $e) {
|
|
|
|
| 30 |
$session->addException($e, $this->__('There was a problem with the unsubscription: %s', $e->getMessage()));
|
| 31 |
+
} catch (Exception $e) {
|
|
|
|
| 32 |
$session->addException($e, $this->__('There was a problem with the unsubscription.'));
|
| 33 |
}
|
| 34 |
}
|
app/design/frontend/base/default/template/newsletter/manage/resend.phtml
CHANGED
|
@@ -1 +1,14 @@
|
|
| 1 |
-
<?php
|
| 2 |
* Loewenstark_Newsletter
|
| 3 |
*
|
| 4 |
* @category Loewenstark
|
| 5 |
* @package Loewenstark_Newsletter
|
| 6 |
* @author Mathis Klooss <m.klooss@loewenstark.de>
|
| 7 |
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 8 |
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 9 |
*/
|
| 10 |
<li class="control resend_link"><a href="<?php echo $this->getResendUrl() ?>" title="<?php echo $this->__("resend subscription request")?>"><?php echo $this->__("resend subscription request")?></a></li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
* Loewenstark_Newsletter
|
| 2 |
*
|
| 3 |
* @category Loewenstark
|
| 4 |
* @package Loewenstark_Newsletter
|
| 5 |
* @author Mathis Klooss <m.klooss@loewenstark.de>
|
| 6 |
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 7 |
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 8 |
*/
|
| 9 |
<li class="control resend_link"><a href="<?php echo $this->getResendUrl() ?>" title="<?php echo $this->__("resend subscription request")?>"><?php echo $this->__("resend subscription request")?></a></li>
|
| 10 |
+
<?php
|
| 11 |
+
/**
|
| 12 |
+
* Loewenstark_Newsletter
|
| 13 |
+
*
|
| 14 |
+
* @category Loewenstark
|
| 15 |
+
* @package Loewenstark_Newsletter
|
| 16 |
+
* @author Mathis Klooss <m.klooss@loewenstark.de>
|
| 17 |
+
* @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
|
| 18 |
+
* @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
|
| 19 |
+
*/
|
| 20 |
+
?>
|
| 21 |
+
<?php if ($this->isEnabled() && $this->getStatus() == $this->getStatusByName("STATUS_UNCONFIRMED")): ?>
|
| 22 |
+
<li class="control resend_link"><a href="<?php echo $this->getResendUrl(); ?>" title="<?php echo $this->__("resend subscription request"); ?>"><?php echo $this->__("resend subscription request"); ?></a></li>
|
| 23 |
+
<?php endif; ?>
|
app/locale/de_DE/Loewenstark_Newsletter.csv
CHANGED
|
@@ -3,4 +3,5 @@
|
|
| 3 |
"Unsubscribe","Abmelden"
|
| 4 |
"Advanced","Erweitert"
|
| 5 |
"Double Opt-In Magento Default","Double Opt-In Magento Standard"
|
| 6 |
-
"Newsletter confirmation E-Mail has been send!","Bestätigungsemail wurde erneuert versendet."
|
|
|
| 3 |
"Unsubscribe","Abmelden"
|
| 4 |
"Advanced","Erweitert"
|
| 5 |
"Double Opt-In Magento Default","Double Opt-In Magento Standard"
|
| 6 |
+
"Newsletter confirmation E-Mail has been send!","Bestätigungsemail wurde erneuert versendet."
|
| 7 |
+
"resend subscription request","Newsletter Anfrage erneut senden"
|
app/locale/en_US/Loewenstark_Newsletter.csv
CHANGED
|
@@ -3,4 +3,5 @@
|
|
| 3 |
"Unsubscribe","Unsubscribe"
|
| 4 |
"Advanced","Advanced"
|
| 5 |
"Double Opt-In Magento Default","Double Opt-In Magento Default"
|
| 6 |
-
"Newsletter confirmation E-Mail has been send!","Newsletter confirmation E-Mail has been send!"
|
|
|
| 3 |
"Unsubscribe","Unsubscribe"
|
| 4 |
"Advanced","Advanced"
|
| 5 |
"Double Opt-In Magento Default","Double Opt-In Magento Default"
|
| 6 |
+
"Newsletter confirmation E-Mail has been send!","Newsletter confirmation E-Mail has been send!"
|
| 7 |
+
"resend subscription request","resend subscription request"
|
package.xml
CHANGED
|
@@ -1,18 +1,18 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Loewenstark_Newsletter</name>
|
| 4 |
-
<version>1.5.0.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md#licence">GPL-3</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>improvements for newsletter</summary>
|
| 10 |
<description>Change some Methodes and use always Double-OptIn</description>
|
| 11 |
-
<notes>
|
| 12 |
-
<authors><author><name>Mathis Klooss</name><user>mklooss</user><email>
|
| 13 |
-
<date>
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="magecommunity"><dir name="Loewenstark"><dir name="Newsletter"><dir name="Block"><file name="Resendrequest.php" hash="
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.2.12</min><max>7.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Loewenstark_Newsletter</name>
|
| 4 |
+
<version>1.5.0.3</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md#licence">GPL-3</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
<summary>improvements for newsletter</summary>
|
| 10 |
<description>Change some Methodes and use always Double-OptIn</description>
|
| 11 |
+
<notes>Bugfixing Release</notes>
|
| 12 |
+
<authors><author><name>Mathis Klooss</name><user>mklooss</user><email>mathis@mage-profis.de</email></author></authors>
|
| 13 |
+
<date>2015-05-28</date>
|
| 14 |
+
<time>11:10:39</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="Loewenstark"><dir name="Newsletter"><dir name="Block"><file name="Resendrequest.php" hash="55df8fe85f36a636b29922df013be7dc"/><file name="Unsubscriber.php" hash="55950d3a63c3b93da9788977d1b27f8a"/></dir><dir name="Helper"><file name="Data.php" hash="8bf03b9b60222ad7d39b28a0b9c6c244"/></dir><dir name="Model"><file name="Subscriber.php" hash="ecaec51802c529c735ce14d14219ba8f"/><file name="Unsubscriber.php" hash="8260443fcd10bb81a87f5be72113cf22"/></dir><dir name="controllers"><file name="ManageController.php" hash="aec8e81b3daec859bef2cc497c0af158"/><file name="SubscriberController.php" hash="b7cefefe4c9b9e97135694e8be172a55"/><file name="UnsubscriberController.php" hash="4df867473e0b66c7ca4e737be52741bf"/></dir><dir name="etc"><file name="config.xml" hash="8c72c21bec942ef75a9b021193ace6de"/><file name="system.xml" hash="42d98424453a6163fe8423f30781ec96"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Loewenstark_Newsletter.xml" hash="b1a0188e4caba4de30dfa3d82144bb37"/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Loewenstark_Newsletter.csv" hash="0a8a84e326d0cbb6fd8a07892e0f7398"/></dir><dir name="en_US"><file name="Loewenstark_Newsletter.csv" hash="c847bfdc7ab12b9ccb08302482338d4e"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="loewenstark"><file name="newsletter.xml" hash="55163ff7baa8b71647770bc9c9369b38"/></dir></dir><dir name="template"><dir name="newsletter"><file name="unsubscribe.phtml" hash="d0bbd72e2290c1f180b6cbc8c8bef5b2"/><dir name="manage"><file name="resend.phtml" hash="9f658b123e267d4f6f566190bd3cb261"/></dir></dir></dir></dir></dir></dir></target></contents>
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.2.12</min><max>7.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
