Loewenstark_Newsletter - Version 1.5.0.1

Version Notes

initial Release

Download this release

Release Info

Developer Mathis Klooss
Extension Loewenstark_Newsletter
Version 1.5.0.1
Comparing to
See all releases


Code changes from version 1.1.0 to 1.5.0.1

app/code/community/Loewenstark/Newsletter/Block/Resendrequest.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Loewenstark_Newsletter
4
+ *
5
+ * @category Loewenstark
6
+ * @package Loewenstark_Newsletter
7
+ * @author Mathis Klooss <m.klooss@loewenstark.de>
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
+ *
18
+ * @return string
19
+ */
20
+ public function getResendUrl()
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
+ */
60
+ public function getStatusByName($string)
61
+ {
62
+ $return = array(
63
+ "STATUS_SUBSCRIBED" => Loewenstark_Newsletter_Model_Subscriber::STATUS_SUBSCRIBED,
64
+ "STATUS_NOT_ACTIVE" => Loewenstark_Newsletter_Model_Subscriber::STATUS_NOT_ACTIVE,
65
+ "STATUS_UNSUBSCRIBED" => Loewenstark_Newsletter_Model_Subscriber::STATUS_UNSUBSCRIBED,
66
+ "STATUS_UNCONFIRMED" => Loewenstark_Newsletter_Model_Subscriber::STATUS_UNCONFIRMED,
67
+ );
68
+ return isset($return[$string]) ? $return[$string] : null;
69
+ }
70
+ }
app/code/community/Loewenstark/Newsletter/Block/Unsubscribe.php DELETED
@@ -1,17 +0,0 @@
1
- <?php
2
-
3
- class Loewenstark_Newsletter_Block_Unsubscribe
4
- extends Mage_Newsletter_Block_Subscribe
5
- {
6
-
7
- /**
8
- * Retrieve form action url and set "secure" param to avoid confirm
9
- * message when we submit form from secure page to unsecure
10
- *
11
- * @return string
12
- */
13
- public function getFormActionUrl()
14
- {
15
- return $this->getUrl('newsletter/unsubscribe', array('_secure' => true));
16
- }
17
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Loewenstark/Newsletter/Block/Unsubscriber.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Loewenstark_Newsletter
4
+ *
5
+ * @category Loewenstark
6
+ * @package Loewenstark_Newsletter
7
+ * @author Mathis Klooss <m.klooss@loewenstark.de>
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
18
+ *
19
+ * @return string
20
+ */
21
+ public function getFormActionUrl()
22
+ {
23
+ return $this->getUrl('newsletter/unsubscriber', array('_secure' => true));
24
+ }
25
+ }
app/code/community/Loewenstark/Newsletter/Helper/Data.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Loewenstark_Newsletter
4
+ *
5
+ * @category Loewenstark
6
+ * @package Loewenstark_Newsletter
7
+ * @author Mathis Klooss <m.klooss@loewenstark.de>
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
+ }
app/code/community/Loewenstark/Newsletter/Model/Subscriber.php ADDED
@@ -0,0 +1,220 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Loewenstark_Newsletter
4
+ *
5
+ * @category Loewenstark
6
+ * @package Loewenstark_Newsletter
7
+ * @author Mathis Klooss <m.klooss@loewenstark.de>
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
+ CONST XML_PATH_ADVANCED_DOUBELOPTIN = "newsletter/advanced/doubleoptinmagedefault";
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
+ *
25
+ * @param string $email
26
+ * @throws Exception
27
+ * @return int
28
+ */
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
+
44
+ $isConfirmNeed = (Mage::getStoreConfig(self::XML_PATH_CONFIRMATION_FLAG) == 1) ? true : false;
45
+ $isOwnSubscribes = false;
46
+ $ownerId = Mage::getModel('customer/customer')
47
+ ->setWebsiteId(Mage::app()->getStore()->getWebsiteId())
48
+ ->loadByEmail($email)
49
+ ->getId();
50
+ $isSubscribeOwnEmail = $customerSession->isLoggedIn() && $ownerId == $customerSession->getId();
51
+
52
+ if (!$this->getId() || $this->getStatus() == self::STATUS_UNSUBSCRIBED
53
+ || $this->getStatus() == self::STATUS_NOT_ACTIVE
54
+ ) {
55
+ if ($isConfirmNeed === true) {
56
+ // BOF: changed for force double opt in
57
+ $this->setStatus(self::STATUS_UNCONFIRMED);
58
+ // EOF: changed for force double opt in
59
+ } else {
60
+ $this->setStatus(self::STATUS_SUBSCRIBED);
61
+ }
62
+ $this->setSubscriberEmail($email);
63
+ }
64
+
65
+ if ($isSubscribeOwnEmail) {
66
+ $this->setStoreId($customerSession->getCustomer()->getStoreId());
67
+ $this->setCustomerId($customerSession->getCustomerId());
68
+ } else {
69
+ $this->setStoreId(Mage::app()->getStore()->getId());
70
+ $this->setCustomerId(0);
71
+ }
72
+
73
+ $this->setIsStatusChanged(true);
74
+
75
+ try {
76
+ $this->save();
77
+ if ($isConfirmNeed === true
78
+ && $isOwnSubscribes === false
79
+ ) {
80
+ $this->sendConfirmationRequestEmail();
81
+ } else {
82
+ $this->sendConfirmationSuccessEmail();
83
+ }
84
+
85
+ return $this->getStatus();
86
+ } catch (Exception $e) {
87
+ throw new Exception($e->getMessage());
88
+ }
89
+ }
90
+
91
+ /**
92
+ * Saving customer subscription status
93
+ *
94
+ * @param Mage_Customer_Model_Customer $customer
95
+ * @return Mage_Newsletter_Model_Subscriber
96
+ */
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()) {
108
+ $this->setImportMode(true);
109
+ }
110
+
111
+ if (!$customer->getIsSubscribed() && !$this->getId()) {
112
+ // If subscription flag not set or customer is not a subscriber
113
+ // and no subscribe below
114
+ return $this;
115
+ }
116
+
117
+ if(!$this->getId()) {
118
+ $this->setSubscriberConfirmCode($this->randomSequence());
119
+ }
120
+
121
+ /*
122
+ * Logical mismatch between customer registration confirmation code and customer password confirmation
123
+ */
124
+ $confirmation = null;
125
+ if ($customer->isConfirmationRequired() && ($customer->getConfirmation() != $customer->getPassword())) {
126
+ $confirmation = $customer->getConfirmation();
127
+ }
128
+
129
+ $sendInformationEmail = false;
130
+ if ($customer->hasIsSubscribed()) {
131
+ $status = $customer->getIsSubscribed() ? self::STATUS_UNCONFIRMED : self::STATUS_UNSUBSCRIBED;
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;
141
+ } else {
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();
155
+ }
156
+ $this->setStoreId($storeId)
157
+ ->setCustomerId($customer->getId())
158
+ ->setEmail($customer->getEmail());
159
+ } else {
160
+ $this->setStoreId($customer->getStoreId())
161
+ ->setEmail($customer->getEmail());
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) {
170
+ $this->sendUnsubscriptionEmail();
171
+ } elseif ($this->getIsStatusChanged() && $status == self::STATUS_SUBSCRIBED) {
172
+ $this->sendConfirmationSuccessEmail();
173
+ } elseif ($this->getIsStatusChanged() && $status == self::STATUS_UNCONFIRMED) {
174
+ $this->sendConfirmationRequestEmail();
175
+ }
176
+ }
177
+ }
178
+ return $this;
179
+ }
180
+
181
+ /**
182
+ * Confirms subscriber newsletter
183
+ *
184
+ * @param string $code
185
+ * @return boolean
186
+ */
187
+ public function confirm($code)
188
+ {
189
+ $parent = (bool) parent::confirm($code);
190
+ if( $parent ) {
191
+ $this->sendConfirmationSuccessEmail();
192
+ return true;
193
+ }
194
+ return false;
195
+ }
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( $this->_sendConfirmationSuccessEmail ) {
207
+ parent::sendConfirmationSuccessEmail();
208
+ $this->_sendConfirmationSuccessEmail = !$this->_sendConfirmationSuccessEmail;
209
+ }
210
+ return $this;
211
+ }
212
+
213
+ public function sendConfirmationRequestEmail() {
214
+ if( $this->_sendConfirmationRequestEmail ) {
215
+ parent::sendConfirmationRequestEmail();
216
+ $this->_sendConfirmationRequestEmail = !$this->_sendConfirmationRequestEmail;
217
+ }
218
+ return $this;
219
+ }
220
+ }
app/code/community/Loewenstark/Newsletter/Model/Unsubscribe.php DELETED
@@ -1,58 +0,0 @@
1
- <?php
2
-
3
- class Loewenstark_Newsletter_Block_Unsubscribe
4
- extends Mage_Newsletter_Model_Subscriber
5
- {
6
- /** @var bool $_sendConfirmationSuccessEmail check if email already send **/
7
- private $_sendConfirmationSuccessEmail = true;
8
-
9
- /**
10
- * unsubscribes by email
11
- *
12
- * @param string $email
13
- * @throws Exception
14
- * @return int
15
- */
16
- public function unsubscribeByEmail($email) {
17
- $this->setStoreId(Mage::app()->getStore()->getId());
18
- $this->loadByEmail($email);
19
- if( !$this->getId() ) {
20
- return false;
21
- }
22
- $this->setCheckCode($this->getCode());
23
- $this->unsubscribe();
24
- return $this->getStatus();
25
- }
26
-
27
- /**
28
- * Confirms subscriber newsletter
29
- *
30
- * @param string $code
31
- * @return boolean
32
- */
33
- public function confirm($code)
34
- {
35
- $parent = (bool) parent::confirm($code);
36
- if( $parent ) {
37
- $this->sendConfirmationSuccessEmail();
38
- return true;
39
- }
40
- return false;
41
- }
42
-
43
- /**
44
- * Sends out confirmation success email
45
- *
46
- * @see Mage_Newsletter_Model_Subscriber::sendConfirmationSuccessEmail
47
- *
48
- * @return Mage_Newsletter_Model_Subscriber
49
- */
50
- public function sendConfirmationSuccessEmail() {
51
- // do not send two E-Mails, may Magento will be implements this line in methode self::confirm($code)
52
- if( $this->_sendConfirmationSuccessEmail ) {
53
- parent::sendConfirmationSuccessEmail();
54
- $this->_sendConfirmationSuccessEmail = !$this->_sendConfirmationSuccessEmail;
55
- }
56
- return $this;
57
- }
58
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/community/Loewenstark/Newsletter/Model/Unsubscriber.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Loewenstark_Newsletter
4
+ *
5
+ * @category Loewenstark
6
+ * @package Loewenstark_Newsletter
7
+ * @author Mathis Klooss <m.klooss@loewenstark.de>
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
+ *
18
+ * @param string $email
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( !$this->getId() ) {
26
+ return false;
27
+ }
28
+ $this->setCheckCode($this->getCode());
29
+ $this->unsubscribe();
30
+ return $this->getStatus();
31
+ }
32
+ }
app/code/community/Loewenstark/Newsletter/controllers/ManageController.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Loewenstark_Newsletter
4
+ *
5
+ * @category Loewenstark
6
+ * @package Loewenstark_Newsletter
7
+ * @author Mathis Klooss <m.klooss@loewenstark.de>
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();
27
+ }
28
+ }
app/code/community/Loewenstark/Newsletter/controllers/SubscriberController.php ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Loewenstark_Newsletter
4
+ *
5
+ * @category Loewenstark
6
+ * @package Loewenstark_Newsletter
7
+ * @author Mathis Klooss <m.klooss@loewenstark.de>
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
16
+ */
17
+ public function newAction()
18
+ {
19
+ if ($this->getRequest()->isPost() && $this->getRequest()->getPost('email')) {
20
+ $session = Mage::getSingleton('core/session');
21
+ $customerSession = Mage::getSingleton('customer/session');
22
+ $helper = Mage::helper("lws_newsletter");
23
+ $email = (string) $this->getRequest()->getPost('email');
24
+
25
+ try {
26
+ if (!Zend_Validate::is($email, 'EmailAddress')) {
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)
40
+ ->getId();
41
+ if ($ownerId !== null && $ownerId != $customerSession->getId()) {
42
+ Mage::throwException($helper->__('This email address is already assigned to another user.'));
43
+ }
44
+ }
45
+
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
+ }
61
+ $this->_redirectReferer();
62
+ }
63
+ }
app/code/community/Loewenstark/Newsletter/controllers/UnsubscriberController.php CHANGED
@@ -1,6 +1,14 @@
1
  <?php
2
-
3
- class Loewenstark_Newsletter_UnsubscribeController
 
 
 
 
 
 
 
 
4
  extends Mage_Core_Controller_Front_Action
5
  {
6
  public function indexAction()
@@ -14,7 +22,7 @@ extends Mage_Core_Controller_Front_Action
14
  Mage::throwException($this->__('Please enter a valid email address.'));
15
  }
16
 
17
- $status = Mage::getModel('newsletter/unsubscribe')->unsubscribeByEmail($email);
18
  $session->addSuccess($this->__('You have been unsubscribed.'));
19
  }
20
  catch (Mage_Core_Exception $e) {
@@ -26,4 +34,4 @@ extends Mage_Core_Controller_Front_Action
26
  }
27
  $this->_redirectReferer();
28
  }
29
- }
1
  <?php
2
+ /**
3
+ * Loewenstark_Newsletter
4
+ *
5
+ * @category Loewenstark
6
+ * @package Loewenstark_Newsletter
7
+ * @author Mathis Klooss <m.klooss@loewenstark.de>
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()
22
  Mage::throwException($this->__('Please enter a valid email address.'));
23
  }
24
 
25
+ $status = Mage::getModel('newsletter/unsubscriber')->unsubscribeByEmail($email);
26
  $session->addSuccess($this->__('You have been unsubscribed.'));
27
  }
28
  catch (Mage_Core_Exception $e) {
34
  }
35
  $this->_redirectReferer();
36
  }
37
+ }
app/code/community/Loewenstark/Newsletter/etc/config.xml CHANGED
@@ -1,8 +1,19 @@
1
  <?xml version="1.0" encoding="UTF-8"?>
 
 
 
 
 
 
 
 
 
 
 
2
  <config>
3
  <modules>
4
  <Loewenstark_Newsletter>
5
- <version>1.1.0</version>
6
  </Loewenstark_Newsletter>
7
  </modules>
8
  <frontend>
@@ -37,13 +48,19 @@
37
  </secure_url>
38
  </frontend>
39
  <global>
 
 
 
 
 
40
  <models>
41
  <lws_newsletter>
42
  <class>Loewenstark_Newsletter_Model</class>
43
  </lws_newsletter>
44
  <newsletter>
45
  <rewrite>
46
- <unsubscribe>Loewenstark_Newsletter_Model_Unsubscribe</unsubscribe>
 
47
  </rewrite>
48
  </newsletter>
49
  </models>
@@ -52,10 +69,18 @@
52
  <class>Loewenstark_Newsletter_Block</class>
53
  </lws_newsletter>
54
  <newsletter>
55
- <rewrite>Mage_Newsletter_Block_Unsubscribe
56
- <unsubscribe>Loewenstark_Newsletter_Block_Unsubscribe</unsubscribe>
 
57
  </rewrite>
58
  </newsletter>
59
  </blocks>
60
  </global>
61
- </config>
 
 
 
 
 
 
 
1
  <?xml version="1.0" encoding="UTF-8"?>
2
+ <!--
3
+ /**
4
+ * Loewenstark_Newsletter
5
+ *
6
+ * @category Loewenstark
7
+ * @package Loewenstark_Newsletter
8
+ * @author Mathis Klooss <m.klooss@loewenstark.de>
9
+ * @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
10
+ * @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
11
+ */
12
+ //-->
13
  <config>
14
  <modules>
15
  <Loewenstark_Newsletter>
16
+ <version>1.5.0.0</version>
17
  </Loewenstark_Newsletter>
18
  </modules>
19
  <frontend>
48
  </secure_url>
49
  </frontend>
50
  <global>
51
+ <helpers>
52
+ <lws_newsletter>
53
+ <class>Loewenstark_Newsletter_Helper</class>
54
+ </lws_newsletter>
55
+ </helpers>
56
  <models>
57
  <lws_newsletter>
58
  <class>Loewenstark_Newsletter_Model</class>
59
  </lws_newsletter>
60
  <newsletter>
61
  <rewrite>
62
+ <unsubscriber>Loewenstark_Newsletter_Model_Unsubscriber</unsubscriber>
63
+ <subscriber>Loewenstark_Newsletter_Model_Subscriber</subscriber>
64
  </rewrite>
65
  </newsletter>
66
  </models>
69
  <class>Loewenstark_Newsletter_Block</class>
70
  </lws_newsletter>
71
  <newsletter>
72
+ <rewrite>
73
+ <unsubscriber>Loewenstark_Newsletter_Block_Unsubscriber</unsubscriber>
74
+ <unsubscribe>Loewenstark_Newsletter_Block_Unsubscriber</unsubscribe><!-- fallback //-->
75
  </rewrite>
76
  </newsletter>
77
  </blocks>
78
  </global>
79
+ <default>
80
+ <newsletter>
81
+ <advanced>
82
+ <doubleoptinmagedefault>0</doubleoptinmagedefault>
83
+ </advanced>
84
+ </newsletter>
85
+ </default>
86
+ </config>
app/code/community/Loewenstark/Newsletter/etc/system.xml ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Loewenstark_Newsletter
5
+ *
6
+ * @category Loewenstark
7
+ * @package Loewenstark_Newsletter
8
+ * @author Mathis Klooss <m.klooss@loewenstark.de>
9
+ * @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
10
+ * @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
11
+ */
12
+ //-->
13
+ <config>
14
+ <sections>
15
+ <newsletter translate="label" module="lws_newsletter">
16
+ <groups>
17
+ <advanced translate="label">
18
+ <label>Advanced</label>
19
+ <frontend_type>text</frontend_type>
20
+ <sort_order>1</sort_order>
21
+ <show_in_default>1</show_in_default>
22
+ <show_in_website>1</show_in_website>
23
+ <show_in_store>1</show_in_store>
24
+ <fields>
25
+ <doubleoptinmagedefault translate="label">
26
+ <label>Double Opt-In Magento Default</label>
27
+ <frontend_type>select</frontend_type>
28
+ <source_model>adminhtml/system_config_source_yesno</source_model>
29
+ <sort_order>1</sort_order>
30
+ <show_in_default>1</show_in_default>
31
+ <show_in_website>1</show_in_website>
32
+ <show_in_store>1</show_in_store>
33
+ </doubleoptinmagedefault>
34
+ </fields>
35
+ </advanced>
36
+ </groups>
37
+ </newsletter>
38
+ </sections>
39
+ </config>
app/design/frontend/base/default/layout/loewenstark/newsletter.xml CHANGED
@@ -1,8 +1,31 @@
1
  <?xml version="1.0"?>
 
 
 
 
 
 
 
 
 
 
 
2
  <layout version="0.2.0">
 
3
  <default>
4
  <reference name="left">
5
- <block type="newsletter/unsubscribe" name="newsletter.unsubscribe" as="newsletter_unsubscribe" after="newsletter" template="newsletter/unsubscribe.phtml"/>
6
  </reference>
7
  </default>
 
 
 
 
 
 
 
 
 
 
 
8
  </layout>
1
  <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Loewenstark_Newsletter
5
+ *
6
+ * @category Loewenstark
7
+ * @package Loewenstark_Newsletter
8
+ * @author Mathis Klooss <m.klooss@loewenstark.de>
9
+ * @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
10
+ * @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
11
+ */
12
+ //-->
13
  <layout version="0.2.0">
14
+
15
  <default>
16
  <reference name="left">
17
+ <block type="newsletter/unsubscriber" name="newsletter.unsubscriber" as="newsletter_unsubscriber" after="newsletter" template="newsletter/unsubscribe.phtml" translate="label"/>
18
  </reference>
19
  </default>
20
+
21
+ <!-- add resend link -->
22
+ <newsletter_manage_index>
23
+ <reference name="customer_newsletter">
24
+ <!-- Missing core/text_list in Magento Default //-->
25
+ <block type="core/text_list" name="customer.form.newsletter.extra" translate="label">
26
+ <block type="lws_newsletter/resendrequest" name="resend.newsletter" template="newsletter/manage/resend.phtml" />
27
+ </block>
28
+ </reference>
29
+ </newsletter_manage_index>
30
+
31
  </layout>
app/design/frontend/base/default/template/newsletter/manage/resend.phtml ADDED
@@ -0,0 +1 @@
 
0
  * Loewenstark_Newsletter
1
  *
2
  * @category Loewenstark
3
  * @package Loewenstark_Newsletter
4
  * @author Mathis Klooss <m.klooss@loewenstark.de>
5
  * @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
6
  * @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
7
  */
8
  <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
+ <?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>
app/design/frontend/base/default/template/newsletter/unsubscribe.phtml CHANGED
@@ -1,12 +1,13 @@
1
  <?php
2
  /**
3
- * Loewenstark_Newsletter
4
- *
5
- * @category design
6
- * @package Loewenstark_Newsletter
7
- * @copyright Copyright (c) 2012 Mathis Klooss (http://www.loewenstark.de/)
8
- * @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
9
- */
 
10
  ?>
11
  <div class="block block-subscribe block-unsubscribe">
12
  <div class="block-title">
1
  <?php
2
  /**
3
+ * Loewenstark_Newsletter
4
+ *
5
+ * @category Loewenstark
6
+ * @package Loewenstark_Newsletter
7
+ * @author Mathis Klooss <m.klooss@loewenstark.de>
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
  ?>
12
  <div class="block block-subscribe block-unsubscribe">
13
  <div class="block-title">
app/etc/modules/Loewenstark_Newsletter.xml CHANGED
@@ -1,12 +1,23 @@
1
  <?xml version="1.0"?>
 
 
 
 
 
 
 
 
 
 
 
2
  <config>
3
- <modules>
4
- <Loewenstark_Newsletter>
5
- <active>true</active>
6
- <codePool>community</codePool>
7
  <depends>
8
  <Mage_Newsletter />
9
  </depends>
10
- </Loewenstark_Newsletter>
11
- </modules>
12
- </config>
1
  <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Loewenstark_Newsletter
5
+ *
6
+ * @category Loewenstark
7
+ * @package Loewenstark_Newsletter
8
+ * @author Mathis Klooss <m.klooss@loewenstark.de>
9
+ * @copyright 2013 Loewenstark Web-Solution GmbH (http://www.loewenstark.de). All rights served.
10
+ * @license https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md
11
+ */
12
+ //-->
13
  <config>
14
+ <modules>
15
+ <Loewenstark_Newsletter>
16
+ <active>true</active>
17
+ <codePool>community</codePool>
18
  <depends>
19
  <Mage_Newsletter />
20
  </depends>
21
+ </Loewenstark_Newsletter>
22
+ </modules>
23
+ </config>
app/locale/de_DE/Loewenstark_Newsletter.csv CHANGED
@@ -1,3 +1,6 @@
1
- "Newsletter Unsubscribe","Newsletter Abmelden"
2
- "Unsubscribe Our Newsletter:","Vom Newsletter abmelden:"
3
- "Unsubscribe","Abmelden"
 
 
 
1
+ "Newsletter Unsubscribe","Newsletter Abmelden"
2
+ "Unsubscribe Our Newsletter:","Vom Newsletter abmelden:"
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."
app/locale/en_US/Loewenstark_Newsletter.csv CHANGED
@@ -1,3 +1,6 @@
1
- "Newsletter Unsubscribe","Newsletter Unsubscribe"
2
- "Unsubscribe Our Newsletter:","Unsubscribe Our Newsletter:"
3
- "Unsubscribe","Unsubscribe"
 
 
 
1
+ "Newsletter Unsubscribe","Newsletter Unsubscribe"
2
+ "Unsubscribe Our Newsletter:","Unsubscribe Our Newsletter:"
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!"
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Loewenstark_Newsletter</name>
4
- <version>1.1.0</version>
5
  <stability>stable</stability>
6
- <license uri="https://github.com/mklooss/Loewenstark_Newsletter/blob/master/README.md">GPL-3</license>
7
  <channel>community</channel>
8
  <extends/>
9
- <summary>unscubscribe as guest, send double opt in confirmation</summary>
10
- <description>unscubscribe as guest, send double opt in confirmation</description>
11
- <notes>initial connect release</notes>
12
  <authors><author><name>Mathis Klooss</name><user>mklooss</user><email>m.klooss@loewenstark.de</email></author></authors>
13
- <date>2012-12-07</date>
14
- <time>08:59:05</time>
15
- <contents><target name="magecommunity"><dir name="Loewenstark"><dir name="Newsletter"><dir><dir name="Block"><file name="Unsubscribe.php" hash="03cf2c135ca87e9d15c2cb92a0a21ee0"/></dir><dir name="Model"><file name="Unsubscribe.php" hash="3379279490d57ffecbe362750609a9bb"/></dir><dir name="controllers"><file name="UnsubscriberController.php" hash="191cf8f7ecefa2c968de1efb689d9877"/></dir><dir name="etc"><file name="config.xml" hash="9dfcd5f68236e8136ffa7d400d063907"/></dir></dir></dir></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=""/></dir></dir><dir name="template"><dir name="newsletter"><file name="unsubscribe.phtml" hash=""/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Loewenstark_Newsletter.xml" hash=""/></dir></target><target name="magelocale"><dir name="de_DE"><file name="Loewenstark_Newsletter.csv" hash=""/></dir><dir name="en_US"><file name="Loewenstark_Newsletter.csv" hash=""/></dir></target></contents>
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.1</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>initial Release</notes>
12
  <authors><author><name>Mathis Klooss</name><user>mklooss</user><email>m.klooss@loewenstark.de</email></author></authors>
13
+ <date>2013-03-13</date>
14
+ <time>12:56:53</time>
15
+ <contents><target name="magecommunity"><dir name="Loewenstark"><dir name="Newsletter"><dir name="Block"><file name="Resendrequest.php" hash="b69b793afe05f10b3956514b1e78f89d"/><file name="Unsubscriber.php" hash="e197602d9029cfbb61d75964c22d65e2"/></dir><dir name="Helper"><file name="Data.php" hash="7abb3899d5a9beb28c70593c970bd458"/></dir><dir name="Model"><file name="Subscriber.php" hash="04640f5b6ab1eed90c9d00dfe6176389"/><file name="Unsubscriber.php" hash="4b9551e6582fe055fe20371b9046d78a"/></dir><dir name="controllers"><file name="ManageController.php" hash="028d8b15ca87cd6450dea721ff72777c"/><file name="SubscriberController.php" hash="3ab7d648854f8daac7f232f898d44e2b"/><file name="UnsubscriberController.php" hash="34c861574a275e4cf3021492c125cbe2"/></dir><dir name="etc"><file name="config.xml" hash="f23bdc5514051581898676de560ab9b1"/><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="f3ea8e88e78c77da134445ec58c83467"/></dir><dir name="en_US"><file name="Loewenstark_Newsletter.csv" hash="54027db990f7964ac148005a2a38632f"/></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="2d97ac03260c125f7a63fccc88027031"/></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>