Newsletter - Version 5.5.7

Version Description

  • Fixed the unsubscription multilanguage messages using even the user language
  • Fixed the goodby message
Download this release

Release Info

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

Code changes from version 5.5.4 to 5.5.7

includes/module.php CHANGED
@@ -1709,7 +1709,21 @@ class NewsletterModule {
1709
  return $url;
1710
  }
1711
 
1712
- function get_current_language() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1713
  if (class_exists('SitePress')) {
1714
  $current_language = apply_filters('wpml_current_language', '');
1715
  if ($current_language == 'all') {
1709
  return $url;
1710
  }
1711
 
1712
+ /**
1713
+ * Return the current language code. Optionally, if a user is passed and it has a language
1714
+ * the user language is returned.
1715
+ * If there is no language available, an empty string is returned.
1716
+ *
1717
+ * @param TNP_User $user
1718
+ * @return string The language code
1719
+ */
1720
+ function get_current_language($user = null) {
1721
+ // TODO: Check if the blog is multilanguage?
1722
+
1723
+ if ($user && $user->language) {
1724
+ return $user->language;
1725
+ }
1726
+
1727
  if (class_exists('SitePress')) {
1728
  $current_language = apply_filters('wpml_current_language', '');
1729
  if ($current_language == 'all') {
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.5.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.5.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.5.7
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.5.7');
18
 
19
  global $newsletter, $wpdb;
20
 
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === Newsletter ===
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing,automation,automated
3
  Requires at least: 3.4.0
4
- Tested up to: 4.9.6
5
- Stable tag: 5.5.4
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
@@ -107,6 +107,16 @@ Thank you, The Newsletter Team
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
 
 
 
 
 
110
  = 5.5.4 =
111
 
112
  * WPML integration. [Read our integration page](https://www.thenewsletterplugin.com/documentation/multilanguage)
1
  === Newsletter ===
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing,automation,automated
3
  Requires at least: 3.4.0
4
+ Tested up to: 4.9.7
5
+ Stable tag: 5.5.7
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
107
 
108
  == Changelog ==
109
 
110
+ = 5.5.7 =
111
+
112
+ * Fixed the unsubscription multilanguage messages using even the user language
113
+ * Fixed the goodby message
114
+
115
+ = 5.5.5 =
116
+
117
+ * Minimal form fix with WPML
118
+ * Privacy label fix with WPML
119
+
120
  = 5.5.4 =
121
 
122
  * WPML integration. [Read our integration page](https://www.thenewsletterplugin.com/documentation/multilanguage)
subscription/subscription.php CHANGED
@@ -1292,7 +1292,8 @@ class NewsletterSubscription extends NewsletterModule {
1292
  }
1293
 
1294
  function get_privacy_field() {
1295
- $privacy_status = (int) $this->options_profile['privacy_status'];
 
1296
  $buffer = '<label>';
1297
  if ($privacy_status === 1) {
1298
  $buffer .= '<input type="checkbox" name="ny" required class="tnp-privacy">&nbsp;';
@@ -1300,9 +1301,9 @@ class NewsletterSubscription extends NewsletterModule {
1300
  $url = $this->get_privacy_url();
1301
  if (!empty($url)) {
1302
  $buffer .= '<a target="_blank" href="' . esc_attr($url) . '">';
1303
- $buffer .= esc_attr($this->options_profile['privacy']) . '</a>';
1304
  } else {
1305
- $buffer .= esc_html($this->options_profile['privacy']);
1306
  }
1307
 
1308
  $buffer .= "</label>";
@@ -1608,7 +1609,8 @@ class NewsletterSubscription extends NewsletterModule {
1608
  if (!is_array($attrs)) {
1609
  $attrs = array();
1610
  }
1611
- $attrs = array_merge(array('class' => '', 'referrer' => 'minimal', 'button' => $this->options_profile['subscribe'], 'placeholder' => $this->options_profile['email']), $attrs);
 
1612
 
1613
  $form = '';
1614
  $form .= '<div class="tnp tnp-subscription-minimal ' . $attrs['class'] . '">';
@@ -1665,7 +1667,7 @@ class NewsletterSubscription extends NewsletterModule {
1665
  $user = $this->get_user_from_request();
1666
  $message_key = $this->get_message_key_from_request();
1667
 
1668
- $message = apply_filters('newsletter_page_text', '', $message_key);
1669
 
1670
  $options = $this->get_options('', $this->get_user_language($user));
1671
 
1292
  }
1293
 
1294
  function get_privacy_field() {
1295
+ $options_profile = $this->get_options('profile', $this->get_current_language());
1296
+ $privacy_status = (int) $options_profile['privacy_status'];
1297
  $buffer = '<label>';
1298
  if ($privacy_status === 1) {
1299
  $buffer .= '<input type="checkbox" name="ny" required class="tnp-privacy">&nbsp;';
1301
  $url = $this->get_privacy_url();
1302
  if (!empty($url)) {
1303
  $buffer .= '<a target="_blank" href="' . esc_attr($url) . '">';
1304
+ $buffer .= esc_attr($options_profile['privacy']) . '</a>';
1305
  } else {
1306
+ $buffer .= esc_html($options_profile['privacy']);
1307
  }
1308
 
1309
  $buffer .= "</label>";
1609
  if (!is_array($attrs)) {
1610
  $attrs = array();
1611
  }
1612
+ $options_profile = $this->get_options('profile', $this->get_current_language());
1613
+ $attrs = array_merge(array('class' => '', 'referrer' => 'minimal', 'button' => $options_profile['subscribe'], 'placeholder' => $options_profile['email']), $attrs);
1614
 
1615
  $form = '';
1616
  $form .= '<div class="tnp tnp-subscription-minimal ' . $attrs['class'] . '">';
1667
  $user = $this->get_user_from_request();
1668
  $message_key = $this->get_message_key_from_request();
1669
 
1670
+ $message = apply_filters('newsletter_page_text', '', $message_key, $user);
1671
 
1672
  $options = $this->get_options('', $this->get_user_language($user));
1673
 
unsubscription/unsubscription.php CHANGED
@@ -26,7 +26,7 @@ class NewsletterUnsubscription extends NewsletterModule {
26
 
27
  function hook_init() {
28
  add_filter('newsletter_replace', array($this, 'hook_newsletter_replace'), 10, 3);
29
- add_filter('newsletter_page_text', array($this, 'hook_newsletter_page_text'), 10, 2);
30
  }
31
 
32
  function hook_wp_loaded() {
@@ -102,9 +102,9 @@ class NewsletterUnsubscription extends NewsletterModule {
102
  $wpdb->update(NEWSLETTER_USERS_TABLE, array('unsub_email_id' => (int) $email_id, 'unsub_time' => time()), array('id' => $user->id));
103
  }
104
 
105
- $this->send_message('unsubscribed', $user);
106
 
107
- $this->notify_admin($user, 'Newsletter unsubscription');
108
 
109
  return $user;
110
  }
@@ -137,18 +137,20 @@ class NewsletterUnsubscription extends NewsletterModule {
137
  return $text;
138
  }
139
 
140
- function hook_newsletter_page_text($text, $key) {
 
 
141
  if ($key == 'unsubscribe') {
142
- return $this->options['unsubscribe_text'];
143
  }
144
  if ($key == 'unsubscribed') {
145
- return $this->options['unsubscribed_text'];
146
  }
147
  if ($key == 'reactivated') {
148
- return $this->options['reactivated_text'];
149
  }
150
  if ($key == 'unsubscription_error') {
151
- return $this->options['error_text'];
152
  }
153
  return $text;
154
  }
26
 
27
  function hook_init() {
28
  add_filter('newsletter_replace', array($this, 'hook_newsletter_replace'), 10, 3);
29
+ add_filter('newsletter_page_text', array($this, 'hook_newsletter_page_text'), 10, 3);
30
  }
31
 
32
  function hook_wp_loaded() {
102
  $wpdb->update(NEWSLETTER_USERS_TABLE, array('unsub_email_id' => (int) $email_id, 'unsub_time' => time()), array('id' => $user->id));
103
  }
104
 
105
+ NewsletterSubscription::instance()->send_message('unsubscribed', $user);
106
 
107
+ NewsletterSubscription::instance()->notify_admin($user, 'Newsletter unsubscription');
108
 
109
  return $user;
110
  }
137
  return $text;
138
  }
139
 
140
+ function hook_newsletter_page_text($text, $key, $user) {
141
+
142
+ $options = $this->get_options('', $this->get_current_language($user));
143
  if ($key == 'unsubscribe') {
144
+ return $options['unsubscribe_text'];
145
  }
146
  if ($key == 'unsubscribed') {
147
+ return $options['unsubscribed_text'];
148
  }
149
  if ($key == 'reactivated') {
150
+ return $options['reactivated_text'];
151
  }
152
  if ($key == 'unsubscription_error') {
153
+ return $options['error_text'];
154
  }
155
  return $text;
156
  }