Newsletter - Version 5.6.5

Version Description

  • Fixed email validation message
Download this release

Release Info

Developer satollo
Plugin Icon 128x128 Newsletter
Version 5.6.5
Comparing to
See all releases

Code changes from version 5.6.4 to 5.6.5

includes/module.php CHANGED
@@ -1302,6 +1302,22 @@ class NewsletterModule {
1302
 
1303
  return $this->get_user($user);
1304
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1305
 
1306
  /**
1307
  * Create a log entry with the meaningful user data.
1302
 
1303
  return $this->get_user($user);
1304
  }
1305
+
1306
+ /**
1307
+ *
1308
+ * @global wpdb $wpdb
1309
+ * @param TNP_User $user
1310
+ * @return TNP_User
1311
+ */
1312
+ function refresh_user_token($user) {
1313
+ global $wpdb;
1314
+
1315
+ $token = $this->get_token();
1316
+
1317
+ $this->query($wpdb->prepare("update " . NEWSLETTER_USERS_TABLE . " set token=%s where id=%d limit 1", $token, $user->id));
1318
+
1319
+ return $this->get_user($user);
1320
+ }
1321
 
1322
  /**
1323
  * Create a log entry with the meaningful user data.
plugin.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Newsletter
5
  Plugin URI: https://www.thenewsletterplugin.com/plugins/newsletter
6
  Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
7
- Version: 5.6.4
8
  Author: Stefano Lissa & The Newsletter Team
9
  Author URI: https://www.thenewsletterplugin.com
10
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
@@ -14,7 +14,7 @@
14
  */
15
 
16
  // Used as dummy parameter on css and js links
17
- define('NEWSLETTER_VERSION', '5.6.4');
18
 
19
  global $newsletter, $wpdb;
20
 
4
  Plugin Name: Newsletter
5
  Plugin URI: https://www.thenewsletterplugin.com/plugins/newsletter
6
  Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
7
+ Version: 5.6.5
8
  Author: Stefano Lissa & The Newsletter Team
9
  Author URI: https://www.thenewsletterplugin.com
10
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
14
  */
15
 
16
  // Used as dummy parameter on css and js links
17
+ define('NEWSLETTER_VERSION', '5.6.5');
18
 
19
  global $newsletter, $wpdb;
20
 
profile/profile.php CHANGED
@@ -102,8 +102,18 @@ class NewsletterProfile extends NewsletterModule {
102
  return $text;
103
  }
104
 
 
 
 
 
 
 
 
105
  function hook_newsletter_page_text($text, $key, $user) {
106
  if ($key == 'profile') {
 
 
 
107
  $options = $this->get_options('main', $this->get_current_language($user));
108
  return $options['text'];
109
  }
102
  return $text;
103
  }
104
 
105
+ /**
106
+ *
107
+ * @param type $text
108
+ * @param type $key
109
+ * @param TNP_User $user
110
+ * @return string
111
+ */
112
  function hook_newsletter_page_text($text, $key, $user) {
113
  if ($key == 'profile') {
114
+ if (!$user || $user->status == TNP_User::STATUS_UNSUBSCRIBED) {
115
+ return 'Subscriber not found.';
116
+ }
117
  $options = $this->get_options('main', $this->get_current_language($user));
118
  return $options['text'];
119
  }
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === Newsletter ===
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing,automation,automated,mailing list
3
  Requires at least: 3.4.0
4
- Tested up to: 4.9.7
5
- Stable tag: 5.6.4
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
@@ -108,6 +108,10 @@ Thank you, The Newsletter Team
108
 
109
  == Changelog ==
110
 
 
 
 
 
111
  = 5.6.4 =
112
 
113
  * Fixed reactivation message display
1
  === Newsletter ===
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing,automation,automated,mailing list
3
  Requires at least: 3.4.0
4
+ Tested up to: 4.9.8
5
+ Stable tag: 5.6.5
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
108
 
109
  == Changelog ==
110
 
111
+ = 5.6.5 =
112
+
113
+ * Fixed email validation message
114
+
115
  = 5.6.4 =
116
 
117
  * Fixed reactivation message display
subscription/subscription.php CHANGED
@@ -66,6 +66,8 @@ class NewsletterSubscription extends NewsletterModule {
66
 
67
  wp_enqueue_script('newsletter-subscription', plugins_url('newsletter') . '/subscription/validate.js', array(), NEWSLETTER_VERSION, true);
68
 
 
 
69
  $data = array();
70
  $data['messages'] = array();
71
  if (isset($options['email_error'])) {
66
 
67
  wp_enqueue_script('newsletter-subscription', plugins_url('newsletter') . '/subscription/validate.js', array(), NEWSLETTER_VERSION, true);
68
 
69
+ $options = $this->get_options('profile', $this->get_current_language());
70
+
71
  $data = array();
72
  $data['messages'] = array();
73
  if (isset($options['email_error'])) {
unsubscription/unsubscription.php CHANGED
@@ -84,11 +84,12 @@ class NewsletterUnsubscription extends NewsletterModule {
84
  */
85
  function unsubscribe() {
86
  $user = $this->get_user_from_request(true);
87
-
88
  if ($user->status == TNP_User::STATUS_UNSUBSCRIBED) {
89
  return $user;
90
  }
91
 
 
92
  $user = $this->set_user_status($user, TNP_User::STATUS_UNSUBSCRIBED);
93
 
94
  $this->add_user_log($user, 'unsubscribe');
@@ -108,7 +109,7 @@ class NewsletterUnsubscription extends NewsletterModule {
108
 
109
  return $user;
110
  }
111
-
112
  function send_unsubscribed_email($user, $force = false) {
113
  $options = $this->get_options('', $this->get_user_language($user));
114
  if (!$force && !empty($options['unsubscribed_disabled'])) {
@@ -119,7 +120,7 @@ class NewsletterUnsubscription extends NewsletterModule {
119
  $subject = $options['unsubscribed_subject'];
120
 
121
  return NewsletterSubscription::instance()->mail($user->email, $this->replace($subject, $user), $this->replace($message, $user));
122
- }
123
 
124
  /**
125
  * Reactivate the subscriber extracted from the request setting his status
@@ -150,17 +151,24 @@ class NewsletterUnsubscription extends NewsletterModule {
150
  }
151
 
152
  function hook_newsletter_page_text($text, $key, $user = null) {
153
-
154
- if (!$user) return $text;
155
-
156
  $options = $this->get_options('', $this->get_current_language($user));
157
  if ($key == 'unsubscribe') {
158
- return $options['unsubscribe_text'];
 
 
 
159
  }
160
  if ($key == 'unsubscribed') {
 
 
 
161
  return $options['unsubscribed_text'];
162
  }
163
  if ($key == 'reactivated') {
 
 
 
164
  return $options['reactivated_text'];
165
  }
166
  if ($key == 'unsubscription_error') {
84
  */
85
  function unsubscribe() {
86
  $user = $this->get_user_from_request(true);
87
+
88
  if ($user->status == TNP_User::STATUS_UNSUBSCRIBED) {
89
  return $user;
90
  }
91
 
92
+ $user = $this->refresh_user_token($user);
93
  $user = $this->set_user_status($user, TNP_User::STATUS_UNSUBSCRIBED);
94
 
95
  $this->add_user_log($user, 'unsubscribe');
109
 
110
  return $user;
111
  }
112
+
113
  function send_unsubscribed_email($user, $force = false) {
114
  $options = $this->get_options('', $this->get_user_language($user));
115
  if (!$force && !empty($options['unsubscribed_disabled'])) {
120
  $subject = $options['unsubscribed_subject'];
121
 
122
  return NewsletterSubscription::instance()->mail($user->email, $this->replace($subject, $user), $this->replace($message, $user));
123
+ }
124
 
125
  /**
126
  * Reactivate the subscriber extracted from the request setting his status
151
  }
152
 
153
  function hook_newsletter_page_text($text, $key, $user = null) {
154
+
 
 
155
  $options = $this->get_options('', $this->get_current_language($user));
156
  if ($key == 'unsubscribe') {
157
+ if (!$user) {
158
+ return 'Subscriber not found.';
159
+ }
160
+ return $options['error_text'];
161
  }
162
  if ($key == 'unsubscribed') {
163
+ if (!$user) {
164
+ return $options['error_text'];
165
+ }
166
  return $options['unsubscribed_text'];
167
  }
168
  if ($key == 'reactivated') {
169
+ if (!$user) {
170
+ return $options['error_text'];
171
+ }
172
  return $options['reactivated_text'];
173
  }
174
  if ($key == 'unsubscription_error') {