Newsletter - Version 6.7.2

Version Description

  • Fix post permalink with WPML on language specific setting for Newsletter themes and blocks
  • Added action newsletter_user_reactivated
Download this release

Release Info

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

Code changes from version 6.7.1 to 6.7.2

emails/blocks/posts/block.php CHANGED
@@ -103,6 +103,9 @@ if ($posts) {
103
  $out['subject'] = $posts[0]->post_title;
104
  }
105
 
 
 
 
106
  $button_background = $options['button_background'];
107
  $button_label = $options['button_label'];
108
  $button_font_family = $options['button_font_family'];
@@ -491,4 +494,7 @@ remove_all_filters('excerpt_more');
491
 
492
 
493
 
494
- <?php } ?>
 
 
 
103
  $out['subject'] = $posts[0]->post_title;
104
  }
105
 
106
+ $current_language = Newsletter::instance()->get_current_language();
107
+ Newsletter::instance()->switch_language($options['language']);
108
+
109
  $button_background = $options['button_background'];
110
  $button_label = $options['button_label'];
111
  $button_font_family = $options['button_font_family'];
494
 
495
 
496
 
497
+ <?php }
498
+
499
+ Newsletter::instance()->switch_language($options['language']);
500
+
emails/themes/default/theme.php CHANGED
@@ -46,6 +46,8 @@ if (isset($theme_options['theme_posts'])) {
46
 
47
  if (!isset($theme_options['theme_language'])) $theme_options['theme_language'] = '';
48
  $posts = Newsletter::instance()->get_posts($filters, $theme_options['theme_language']);
 
 
49
  }
50
 
51
  ?><!doctype html>
46
 
47
  if (!isset($theme_options['theme_language'])) $theme_options['theme_language'] = '';
48
  $posts = Newsletter::instance()->get_posts($filters, $theme_options['theme_language']);
49
+
50
+ $this->switch_language($theme_options['theme_language']);
51
  }
52
 
53
  ?><!doctype html>
includes/module.php CHANGED
@@ -253,7 +253,11 @@ class NewsletterModule {
253
  global $wpdb;
254
 
255
  $this->logger->debug($query);
 
256
  $r = $wpdb->query($query);
 
 
 
257
  if ($r === false) {
258
  $this->logger->fatal($query);
259
  $this->logger->fatal($wpdb->last_error);
253
  global $wpdb;
254
 
255
  $this->logger->debug($query);
256
+ //$start = microtime(true);
257
  $r = $wpdb->query($query);
258
+ //$this->logger->debug($wpdb->last_query);
259
+ //$this->logger->debug('Execution time: ' . (microtime(true)-$start));
260
+ //$this->logger->debug('Result: ' . $r);
261
  if ($r === false) {
262
  $this->logger->fatal($query);
263
  $this->logger->fatal($wpdb->last_error);
main/test.php CHANGED
@@ -62,6 +62,17 @@ if ($controls->is_action('test')) {
62
  }
63
  }
64
 
 
 
 
 
 
 
 
 
 
 
 
65
  $options = $this->get_options('status');
66
  ?>
67
 
@@ -147,6 +158,23 @@ $options = $this->get_options('status');
147
  <?php echo esc_html($name) ?>
148
  </td>
149
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
150
 
151
  </tbody>
152
  </table>
62
  }
63
  }
64
 
65
+ if ($controls->is_action('optimize-stats')) {
66
+ $this->logger->info('Stats table otpimization');
67
+ $this->query("alter table " . NEWSLETTER_STATS_TABLE . " drop index email_id");
68
+
69
+ $this->query("alter table " . NEWSLETTER_STATS_TABLE . " drop index user_id");
70
+ $this->query("alter table `" . NEWSLETTER_STATS_TABLE . "` modify column `email_id` int(11) not null default 0");
71
+ $this->query("create index email_id on " . NEWSLETTER_STATS_TABLE . " (email_id)");
72
+ $this->query("create index user_id on " . NEWSLETTER_STATS_TABLE . " (user_id)");
73
+ $controls->add_message_done();
74
+ }
75
+
76
  $options = $this->get_options('status');
77
  ?>
78
 
158
  <?php echo esc_html($name) ?>
159
  </td>
160
  </tr>
161
+
162
+ <?php
163
+ $res = $wpdb->get_var("select count(*) from {$wpdb->prefix}newsletter_stats`");
164
+ ?>
165
+
166
+ <?php if ($res > 500) { ?>
167
+ <tr>
168
+ <td>Statistics table optimization</td>
169
+ <td>
170
+
171
+ </td>
172
+ <td>
173
+ The auto-optimization has not been started because your table contains an big number of rows. Run it manually.
174
+ <?php $controls->button('optimize-stats', __('Run', 'newsletter')); ?>
175
+ </td>
176
+ </tr>
177
+ <?php } ?>
178
 
179
  </tbody>
180
  </table>
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: 6.7.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,7 +35,7 @@ if (version_compare(phpversion(), '5.6', '<')) {
35
  return;
36
  }
37
 
38
- define('NEWSLETTER_VERSION', '6.7.1');
39
 
40
  global $newsletter, $wpdb;
41
 
@@ -1259,7 +1259,7 @@ class Newsletter extends NewsletterModule {
1259
  $newsletter_page_url = apply_filters('wpml_permalink', $newsletter_page_url, $language, true);
1260
  }
1261
  if (function_exists('pll_get_post')) {
1262
- $newsletter_page_url = get_permalink(pll_get_post($page->ID));
1263
  }
1264
  }
1265
 
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: 6.7.2
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', '6.7.2');
39
 
40
  global $newsletter, $wpdb;
41
 
1259
  $newsletter_page_url = apply_filters('wpml_permalink', $newsletter_page_url, $language, true);
1260
  }
1261
  if (function_exists('pll_get_post')) {
1262
+ $newsletter_page_url = get_permalink(pll_get_post($page->ID), $language);
1263
  }
1264
  }
1265
 
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.4.1
5
- Stable tag: 6.7.1
6
  Requires PHP: 5.6
7
  Contributors: satollo,webagile,michael-travan
8
 
@@ -113,6 +113,11 @@ Thank you, The Newsletter Team
113
 
114
  == Changelog ==
115
 
 
 
 
 
 
116
  = 6.7.1 =
117
 
118
  * Changed the lists configuration to be more clear
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.4.1
5
+ Stable tag: 6.7.2
6
  Requires PHP: 5.6
7
  Contributors: satollo,webagile,michael-travan
8
 
113
 
114
  == Changelog ==
115
 
116
+ = 6.7.2 =
117
+
118
+ * Fix post permalink with WPML on language specific setting for Newsletter themes and blocks
119
+ * Added action newsletter_user_reactivated
120
+
121
  = 6.7.1 =
122
 
123
  * Changed the lists configuration to be more clear
statistics/statistics.php CHANGED
@@ -21,7 +21,7 @@ class NewsletterStatistics extends NewsletterModule {
21
  }
22
 
23
  function __construct() {
24
- parent::__construct('statistics', '1.2.0');
25
  add_action('wp_loaded', array($this, 'hook_wp_loaded'));
26
  }
27
 
@@ -155,20 +155,20 @@ class NewsletterStatistics extends NewsletterModule {
155
  global $wpdb, $charset_collate;
156
 
157
  parent::upgrade();
158
-
159
- $sql = "CREATE TABLE `" . $wpdb->prefix . "newsletter_stats` (
160
- `id` int(11) NOT NULL AUTO_INCREMENT,
161
- `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
162
- `url` varchar(255) NOT NULL DEFAULT '',
163
- `user_id` int(11) NOT NULL DEFAULT '0',
164
  `email_id` varchar(10) NOT NULL DEFAULT '0',
165
- `ip` varchar(20) NOT NULL DEFAULT '',
166
- PRIMARY KEY (`id`),
167
- KEY `email_id` (`email_id`),
168
- KEY `user_id` (`user_id`)
169
- ) $charset_collate;";
170
 
171
- dbDelta($sql);
172
 
173
  if (empty($this->options['key'])) {
174
  $this->options['key'] = md5($_SERVER['REMOTE_ADDR'] . rand(100000, 999999) . time());
21
  }
22
 
23
  function __construct() {
24
+ parent::__construct('statistics', '1.2.7');
25
  add_action('wp_loaded', array($this, 'hook_wp_loaded'));
26
  }
27
 
155
  global $wpdb, $charset_collate;
156
 
157
  parent::upgrade();
158
+
159
+ $sql = "CREATE TABLE `" . $wpdb->prefix . "newsletter_stats` (
160
+ `id` int(11) NOT NULL AUTO_INCREMENT,
161
+ `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
162
+ `url` varchar(255) NOT NULL DEFAULT '',
163
+ `user_id` int(11) NOT NULL DEFAULT '0',
164
  `email_id` varchar(10) NOT NULL DEFAULT '0',
165
+ `ip` varchar(20) NOT NULL DEFAULT '',
166
+ PRIMARY KEY (`id`),
167
+ KEY `email_id` (`email_id`),
168
+ KEY `user_id` (`user_id`)
169
+ ) $charset_collate;";
170
 
171
+ dbDelta($sql);
172
 
173
  if (empty($this->options['key'])) {
174
  $this->options['key'] = md5($_SERVER['REMOTE_ADDR'] . rand(100000, 999999) . time());
unsubscription/unsubscription.php CHANGED
@@ -143,6 +143,7 @@ class NewsletterUnsubscription extends NewsletterModule {
143
  }
144
  $this->set_user_status($user, TNP_User::STATUS_CONFIRMED);
145
  $this->add_user_log($user, 'reactivate');
 
146
  }
147
 
148
  function hook_newsletter_replace($text, $user, $email) {
143
  }
144
  $this->set_user_status($user, TNP_User::STATUS_CONFIRMED);
145
  $this->add_user_log($user, 'reactivate');
146
+ do_action('newsletter_user_reactivated', $user);
147
  }
148
 
149
  function hook_newsletter_replace($text, $user, $email) {