Newsletter - Version 7.0.1

Version Description

  • Fixed enforced lists by language with Polylang
Download this release

Release Info

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

Code changes from version 7.0.0 to 7.0.1

Files changed (5) hide show
  1. admin.js +0 -2
  2. includes/helper.php +1 -1
  3. plugin.php +2 -2
  4. readme.txt +7 -1
  5. subscription/subscription.php +13 -12
admin.js CHANGED
@@ -59,8 +59,6 @@ function tnp_select_toggle(s, t) {
59
  function tnp_date_onchange(field) {
60
  let id = field.id.substring(0, field.id.lastIndexOf('_'));
61
  let base_field = document.getElementById('options-' + id);
62
- //console.log(base_field);
63
- //let form = field.form;
64
  let year = document.getElementById(id + '_year');
65
  let month = document.getElementById(id + '_month');
66
  let day = document.getElementById(id + '_day');
59
  function tnp_date_onchange(field) {
60
  let id = field.id.substring(0, field.id.lastIndexOf('_'));
61
  let base_field = document.getElementById('options-' + id);
 
 
62
  let year = document.getElementById(id + '_year');
63
  let month = document.getElementById(id + '_month');
64
  let day = document.getElementById(id + '_day');
includes/helper.php CHANGED
@@ -243,7 +243,7 @@ function tnp_resize($media_id, $size) {
243
 
244
  if (!$r) {
245
  Newsletter::instance()->logger->error('Unable to create dir ' . $uploads['basedir'] . '/newsletter/thumbnails/' . $pathinfo['dirname']);
246
- return _tnp_get_default_media($media_id);
247
  }
248
 
249
  $editor = wp_get_image_editor($absolute_file);
243
 
244
  if (!$r) {
245
  Newsletter::instance()->logger->error('Unable to create dir ' . $uploads['basedir'] . '/newsletter/thumbnails/' . $pathinfo['dirname']);
246
+ return _tnp_get_default_media($media_id, $size);
247
  }
248
 
249
  $editor = wp_get_image_editor($absolute_file);
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: 7.0.0
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.
@@ -35,7 +35,7 @@ if (version_compare(phpversion(), '5.6', '<')) {
35
  return;
36
  }
37
 
38
- define('NEWSLETTER_VERSION', '7.0.0');
39
 
40
  global $newsletter, $wpdb;
41
 
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: 7.0.1
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.
35
  return;
36
  }
37
 
38
+ define('NEWSLETTER_VERSION', '7.0.1');
39
 
40
  global $newsletter, $wpdb;
41
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Tags: email, email marketing, newsletter, newsletter subscribers, welcome email, signup forms, contact, lead generation, popup, marketing automation
3
  Requires at least: 3.4.0
4
  Tested up to: 5.6
5
- Stable tag: 7.0.0
6
  Requires PHP: 5.6
7
  Contributors: satollo,webagile,michael-travan
8
  License: GPLv2 or later
@@ -118,6 +118,12 @@ Thank you, The Newsletter Team
118
 
119
  == Changelog ==
120
 
 
 
 
 
 
 
121
  * Added multiple newsletter selection for deletion
122
  * Added text part on welcome and activation email
123
  * Added the attribute "show_form" to "newsletter" shortcode
2
  Tags: email, email marketing, newsletter, newsletter subscribers, welcome email, signup forms, contact, lead generation, popup, marketing automation
3
  Requires at least: 3.4.0
4
  Tested up to: 5.6
5
+ Stable tag: 7.0.1
6
  Requires PHP: 5.6
7
  Contributors: satollo,webagile,michael-travan
8
  License: GPLv2 or later
118
 
119
  == Changelog ==
120
 
121
+ = 7.0.1 =
122
+
123
+ * Fixed enforced lists by language with Polylang
124
+
125
+ = 7.0.0 =
126
+
127
  * Added multiple newsletter selection for deletion
128
  * Added text part on welcome and activation email
129
  * Added the attribute "show_form" to "newsletter" shortcode
subscription/subscription.php CHANGED
@@ -461,12 +461,12 @@ class NewsletterSubscription extends NewsletterModule {
461
  *
462
  * @return \TNP_Subscription
463
  */
464
- function get_default_subscription() {
465
  $subscription = new TNP_Subscription();
 
466
  $subscription->optin = $this->is_double_optin() ? 'double' : 'single';
467
  $subscription->if_exists = empty($this->options['multiple']) ? TNP_Subscription::EXISTING_ERROR : TNP_Subscription::EXISTING_MERGE;
468
 
469
- $language = $this->get_current_language();
470
  $lists = $this->get_lists();
471
  foreach ($lists as $list) {
472
  if ($list->forced) {
@@ -474,7 +474,7 @@ class NewsletterSubscription extends NewsletterModule {
474
  continue;
475
  }
476
  // Enforced by language
477
- if (in_array($language, $list->languages)) {
478
  $subscription->data->lists['' . $list->id] = 1;
479
  }
480
  }
@@ -723,7 +723,15 @@ class NewsletterSubscription extends NewsletterModule {
723
  * @return TNP_Subscription
724
  */
725
  function build_subscription() {
726
- $subscription = $this->get_default_subscription();
 
 
 
 
 
 
 
 
727
  $data = $subscription->data;
728
 
729
  $data->email = $_REQUEST['ne'];
@@ -731,27 +739,19 @@ class NewsletterSubscription extends NewsletterModule {
731
  if (isset($_REQUEST['nn'])) {
732
  $data->name = stripslashes($_REQUEST['nn']);
733
  }
734
- // TODO: required checking
735
 
736
  if (isset($_REQUEST['ns'])) {
737
  $data->surname = stripslashes($_REQUEST['ns']);
738
  }
739
- // TODO: required checking
740
 
741
  if (!empty($_REQUEST['nx'])) {
742
  $data->sex = $_REQUEST['nx'][0];
743
  }
744
- // TODO: valid values check
745
 
746
  if (isset($_REQUEST['nr'])) {
747
  $data->referrer = $_REQUEST['nr'];
748
  }
749
 
750
- $language = '';
751
- if (!empty($_REQUEST['nlang'])) {
752
- $data->language = $_REQUEST['nlang'];
753
- }
754
-
755
  // From the antibot form
756
  if (isset($_REQUEST['nhr'])) {
757
  $data->http_referer = stripslashes($_REQUEST['nhr']);
@@ -784,6 +784,7 @@ class NewsletterSubscription extends NewsletterModule {
784
  continue;
785
  }
786
  $data->lists['' . $list_id] = 1;
 
787
  }
788
  } else {
789
  $this->logger->debug('No lists received');
461
  *
462
  * @return \TNP_Subscription
463
  */
464
+ function get_default_subscription($language = '') {
465
  $subscription = new TNP_Subscription();
466
+ $subscription->data->language = $language;
467
  $subscription->optin = $this->is_double_optin() ? 'double' : 'single';
468
  $subscription->if_exists = empty($this->options['multiple']) ? TNP_Subscription::EXISTING_ERROR : TNP_Subscription::EXISTING_MERGE;
469
 
 
470
  $lists = $this->get_lists();
471
  foreach ($lists as $list) {
472
  if ($list->forced) {
474
  continue;
475
  }
476
  // Enforced by language
477
+ if ($language && in_array($language, $list->languages)) {
478
  $subscription->data->lists['' . $list->id] = 1;
479
  }
480
  }
723
  * @return TNP_Subscription
724
  */
725
  function build_subscription() {
726
+
727
+ $language = '';
728
+ if (!empty($_REQUEST['nlang'])) {
729
+ $language = $_REQUEST['nlang'];
730
+ } else {
731
+ $language = $this->get_current_language();
732
+ }
733
+
734
+ $subscription = $this->get_default_subscription($language);
735
  $data = $subscription->data;
736
 
737
  $data->email = $_REQUEST['ne'];
739
  if (isset($_REQUEST['nn'])) {
740
  $data->name = stripslashes($_REQUEST['nn']);
741
  }
 
742
 
743
  if (isset($_REQUEST['ns'])) {
744
  $data->surname = stripslashes($_REQUEST['ns']);
745
  }
 
746
 
747
  if (!empty($_REQUEST['nx'])) {
748
  $data->sex = $_REQUEST['nx'][0];
749
  }
 
750
 
751
  if (isset($_REQUEST['nr'])) {
752
  $data->referrer = $_REQUEST['nr'];
753
  }
754
 
 
 
 
 
 
755
  // From the antibot form
756
  if (isset($_REQUEST['nhr'])) {
757
  $data->http_referer = stripslashes($_REQUEST['nhr']);
784
  continue;
785
  }
786
  $data->lists['' . $list_id] = 1;
787
+
788
  }
789
  } else {
790
  $this->logger->debug('No lists received');