Newsletter - Version 5.0.6

Version Description

=

  • Improved performance with new db indexes
  • Fixed a bug in social URLs
  • Home URL check on status panel
  • Fixed a not removable notice

=

Download this release

Release Info

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

Code changes from version 5.0.5 to 5.0.6

emails/tnp-composer/blocks/footer-03-social.block.php CHANGED
@@ -46,17 +46,17 @@ $social_icon_url = plugins_url('newsletter') . '/emails/themes/default/images';
46
  <?php } ?>
47
  <?php if (!empty($block_options['soundcloud_url'])) { $configured = true; ?>
48
  <span class="tnpc-row-edit" data-type="image">
49
- <a href="<?php echo $block_options['soundcloud'] ?>"><img src="<?php echo $social_icon_url ?>/soundcloud.png" alt="SoundCloud"></a>
50
  </span>
51
  <?php } ?>
52
  <?php if (!empty($block_options['instagram_url'])) { $configured = true; ?>
53
  <span class="tnpc-row-edit" data-type="image">
54
- <a href="<?php echo $block_options['instagram'] ?>"><img src="<?php echo $social_icon_url ?>/instagram.png" alt="Instagram"></a>
55
  </span>
56
  <?php } ?>
57
  <?php if (!empty($block_options['vimeo_url'])) { $configured = true; ?>
58
  <span class="tnpc-row-edit" data-type="image">
59
- <a href="<?php echo $block_options['vimeo'] ?>"><img src="<?php echo $social_icon_url ?>/vimeo.png" alt="Vimeo"></a>
60
  </span>
61
  <?php } ?>
62
  <?php if (!$configured) { ?>
46
  <?php } ?>
47
  <?php if (!empty($block_options['soundcloud_url'])) { $configured = true; ?>
48
  <span class="tnpc-row-edit" data-type="image">
49
+ <a href="<?php echo $block_options['soundcloud_url'] ?>"><img src="<?php echo $social_icon_url ?>/soundcloud.png" alt="SoundCloud"></a>
50
  </span>
51
  <?php } ?>
52
  <?php if (!empty($block_options['instagram_url'])) { $configured = true; ?>
53
  <span class="tnpc-row-edit" data-type="image">
54
+ <a href="<?php echo $block_options['instagram_url'] ?>"><img src="<?php echo $social_icon_url ?>/instagram.png" alt="Instagram"></a>
55
  </span>
56
  <?php } ?>
57
  <?php if (!empty($block_options['vimeo_url'])) { $configured = true; ?>
58
  <span class="tnpc-row-edit" data-type="image">
59
+ <a href="<?php echo $block_options['vimeo_url'] ?>"><img src="<?php echo $social_icon_url ?>/vimeo.png" alt="Vimeo"></a>
60
  </span>
61
  <?php } ?>
62
  <?php if (!$configured) { ?>
main/info.php CHANGED
@@ -182,7 +182,7 @@ if (!$controls->is_action()) {
182
  <td>
183
  <?php $controls->text('instagram_url', 40); ?>
184
  <p class="description">
185
- Your Vimeo url (e.g. http://instagram.com/...)
186
  </p>
187
  </td>
188
  </tr>
182
  <td>
183
  <?php $controls->text('instagram_url', 40); ?>
184
  <p class="description">
185
+ Your Instagram url (e.g. http://instagram.com/...)
186
  </p>
187
  </td>
188
  </tr>
main/status.php CHANGED
@@ -96,7 +96,7 @@ if ($controls->is_action('test')) {
96
  if (!empty($module->options['return_path'])) {
97
  $controls->messages .= '- Try to remove the return path on main settings.<br>';
98
  }
99
-
100
  $controls->messages .= '<a href="https://www.thenewsletterplugin.com/documentation/email-sending-issues" target="_blank">Read more</a>.';
101
 
102
  $parts = explode('@', $module->options['sender_email']);
@@ -159,7 +159,7 @@ $options = $module->get_options('status');
159
  A test has never run.
160
  <?php } else { ?>
161
  Last test failed with error "<?php echo esc_html($options['mail_error']) ?>".
162
-
163
  <?php } ?>
164
  <?php } else { ?>
165
  Last test was successful. If you didn't receive the test email:
@@ -169,7 +169,7 @@ $options = $module->get_options('status');
169
  <li>If previous points do not apply to you, ask for support to your provider reporting the emails from your blog are not delivered</li>
170
  </ol>
171
  <?php } ?>
172
- <br>
173
  <a href="https://www.thenewsletterplugin.com/documentation/email-sending-issues" target="_blank">Read more to solve your issues, if any</a>.
174
  <br>
175
  Email: <?php $controls->text_email('test_email') ?> <?php $controls->button('test', __('Send a test message')) ?>
@@ -253,7 +253,7 @@ $options = $module->get_options('status');
253
  </td>
254
 
255
  </tr>
256
-
257
  <tr>
258
  <td>Curl version</td>
259
  <td>
@@ -266,17 +266,18 @@ $options = $module->get_options('status');
266
  </td>
267
  <td>
268
  <?php if (!function_exists('curl_version')) { ?>
269
- cUrl is not available, ask the provider to install it and activate the PHP cUrl library
270
- <?php } else {
271
- $version = curl_version();
272
- echo 'Version: ' . $version['version'] . '<br>';
273
- echo 'SSL Version: ' . $version['ssl_version'] . '<br>';
274
-
275
- } ?>
 
276
  </td>
277
 
278
  </tr>
279
-
280
 
281
  <?php
282
  $value = (int) ini_get('max_execution_time');
@@ -307,7 +308,30 @@ $options = $module->get_options('status');
307
  </td>
308
 
309
  </tr>
310
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
311
  <tr>
312
  <td>WP_CONTENT_URL</td>
313
  <td>
@@ -539,22 +563,22 @@ $options = $module->get_options('status');
539
  <?php } ?>
540
  </td>
541
  </tr>
542
-
543
  <tr>
544
  <td>
545
  Cron calls
546
  </td>
547
  <td>
548
- <?php if ($wp_cron_calls_avg > NEWSLETTER_CRON_INTERVAL*1.1) { ?>
549
  <span class="tnp-ko">KO</span>
550
  <?php } else { ?>
551
  <span class="tnp-ok">OK</span>
552
  <?php } ?>
553
  </td>
554
  <td>
555
- <?php if ($wp_cron_calls_avg > NEWSLETTER_CRON_INTERVAL*1.1) { ?>
556
- The blog cron system is NOT triggere enough often.
557
-
558
  <?php } else { ?>
559
 
560
  <?php } ?>
@@ -665,7 +689,55 @@ $options = $module->get_options('status');
665
 
666
  <?php } ?>
667
  </td>
668
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
669
 
670
  <tr>
671
  <td>
96
  if (!empty($module->options['return_path'])) {
97
  $controls->messages .= '- Try to remove the return path on main settings.<br>';
98
  }
99
+
100
  $controls->messages .= '<a href="https://www.thenewsletterplugin.com/documentation/email-sending-issues" target="_blank">Read more</a>.';
101
 
102
  $parts = explode('@', $module->options['sender_email']);
159
  A test has never run.
160
  <?php } else { ?>
161
  Last test failed with error "<?php echo esc_html($options['mail_error']) ?>".
162
+
163
  <?php } ?>
164
  <?php } else { ?>
165
  Last test was successful. If you didn't receive the test email:
169
  <li>If previous points do not apply to you, ask for support to your provider reporting the emails from your blog are not delivered</li>
170
  </ol>
171
  <?php } ?>
172
+ <br>
173
  <a href="https://www.thenewsletterplugin.com/documentation/email-sending-issues" target="_blank">Read more to solve your issues, if any</a>.
174
  <br>
175
  Email: <?php $controls->text_email('test_email') ?> <?php $controls->button('test', __('Send a test message')) ?>
253
  </td>
254
 
255
  </tr>
256
+
257
  <tr>
258
  <td>Curl version</td>
259
  <td>
266
  </td>
267
  <td>
268
  <?php if (!function_exists('curl_version')) { ?>
269
+ cUrl is not available, ask the provider to install it and activate the PHP cUrl library
270
+ <?php
271
+ } else {
272
+ $version = curl_version();
273
+ echo 'Version: ' . $version['version'] . '<br>';
274
+ echo 'SSL Version: ' . $version['ssl_version'] . '<br>';
275
+ }
276
+ ?>
277
  </td>
278
 
279
  </tr>
280
+
281
 
282
  <?php
283
  $value = (int) ini_get('max_execution_time');
308
  </td>
309
 
310
  </tr>
311
+
312
+ <tr>
313
+ <td>Home URL</td>
314
+ <td>
315
+ <?php if (strpos(home_url('/'), 'http') !== 0) { ?>
316
+ <span class="tnp-ko">KO</span>
317
+ <?php } else { ?>
318
+ <span class="tnp-ok">OK</span>
319
+ <?php } ?>
320
+
321
+ </td>
322
+ <td>
323
+ Value: <?php echo home_url('/'); ?>
324
+ <br>
325
+ <?php if (strpos(home_url('/'), 'http') !== 0) { ?>
326
+ Your home URL is not absolute, emails require absolute URLs.
327
+ Probably you have a protocol agnostic plugin installed to manage both HTTPS and HTTP in your
328
+ blog.
329
+ <?php } else { ?>
330
+
331
+ <?php } ?>
332
+ </td>
333
+ </tr>
334
+
335
  <tr>
336
  <td>WP_CONTENT_URL</td>
337
  <td>
563
  <?php } ?>
564
  </td>
565
  </tr>
566
+
567
  <tr>
568
  <td>
569
  Cron calls
570
  </td>
571
  <td>
572
+ <?php if ($wp_cron_calls_avg > NEWSLETTER_CRON_INTERVAL * 1.1) { ?>
573
  <span class="tnp-ko">KO</span>
574
  <?php } else { ?>
575
  <span class="tnp-ok">OK</span>
576
  <?php } ?>
577
  </td>
578
  <td>
579
+ <?php if ($wp_cron_calls_avg > NEWSLETTER_CRON_INTERVAL * 1.1) { ?>
580
+ The blog cron system is NOT triggere enough often.
581
+
582
  <?php } else { ?>
583
 
584
  <?php } ?>
689
 
690
  <?php } ?>
691
  </td>
692
+ </tr>
693
+ <?php
694
+ // Send calls stats
695
+ $send_calls = get_option('newsletter_diagnostic_send_calls', array());
696
+ if (count($send_calls)) {
697
+ $send_max = 0;
698
+ $send_min = PHP_INT_MAX;
699
+ $send_total_time = 0;
700
+ $send_total_emails = 0;
701
+ $send_completed = 0;
702
+ for ($i = 0; $i < count($send_calls); $i++) {
703
+ if (empty($send_calls[$i][2]))
704
+ continue;
705
+
706
+ $delta = $send_calls[$i][1] - $send_calls[$i][0];
707
+ $send_total_time += $delta;
708
+ $send_total_emails += $send_calls[$i][2];
709
+ $send_mean = $delta / $send_calls[$i][2];
710
+ if ($send_min > $send_mean) {
711
+ $send_min = $send_mean;
712
+ }
713
+ if ($send_max < $send_mean) {
714
+ $send_max = $send_mean;
715
+ }
716
+ if (isset($send_calls[$i][3])) {
717
+ $send_completed++;
718
+ }
719
+ }
720
+ $send_mean = $send_total_time / $send_total_emails;
721
+ ?>
722
+ <tr>
723
+ <td>
724
+ Send timing
725
+ </td>
726
+ <td>
727
+
728
+ </td>
729
+ <td>
730
+ Average time to send an email: <?php echo sprintf("%.2f", $send_mean) ?> seconds<br>
731
+ Max mean time measured: <?php echo $send_max ?> seconds<br>
732
+ Min mean time measured: <?php echo $send_min ?> seconds<br>
733
+ Total email in the sample: <?php echo $send_total_emails ?><br>
734
+ Runs in the sample: <?php echo count($send_calls); ?><br>
735
+ Runs prematurely interrupted: <?php echo sprintf("%.2f", (count($send_calls) - $send_completed) * 100.0 / count($send_calls)) ?>%<br>
736
+ </td>
737
+ </tr>
738
+ <?php
739
+ }
740
+ ?>
741
 
742
  <tr>
743
  <td>
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.0.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,7 +14,7 @@
14
  */
15
 
16
  // Used as dummy parameter on css and js links
17
- define('NEWSLETTER_VERSION', '5.0.5');
18
 
19
  global $wpdb, $newsletter;
20
 
@@ -137,7 +137,7 @@ class Newsletter extends NewsletterModule {
137
  // Here because the upgrade is called by the parent constructor and uses the scheduler
138
  add_filter('cron_schedules', array($this, 'hook_cron_schedules'), 1000);
139
 
140
- parent::__construct('main', '1.3.0');
141
 
142
  $max = $this->options['scheduler_max'];
143
  if (!is_numeric($max)) {
@@ -243,36 +243,38 @@ class Newsletter extends NewsletterModule {
243
  parent::upgrade();
244
 
245
 
246
- $this->upgrade_query("create table if not exists " . NEWSLETTER_EMAILS_TABLE . " (id int auto_increment, primary key (id)) $charset_collate");
247
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column message longtext");
248
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column message_text longtext");
249
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column subject varchar(255) not null default ''");
250
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column type varchar(50) not null default ''");
251
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column created timestamp not null default current_timestamp");
252
-
253
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column status enum('new','sending','sent','paused') not null default 'new'");
254
-
255
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column total int not null default 0");
256
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column last_id int not null default 0");
257
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column sent int not null default 0");
258
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column send_on int not null default 0");
259
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column track tinyint not null default 0");
260
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column editor tinyint not null default 0");
261
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column sex char(1) not null default ''");
262
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " change column sex sex char(1) not null default ''");
263
-
264
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column query text");
265
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column preferences text");
266
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column options longtext");
267
-
268
- // Cleans up old installations
269
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " drop column name");
270
- $this->upgrade_query("drop table if exists " . $wpdb->prefix . "newsletter_work");
271
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " convert to character set utf8");
272
-
273
- if ('utf8mb4' === $wpdb->charset) {
274
- $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " convert to character set utf8mb4");
275
- }
 
 
276
 
277
  // WP does not manage composite primary key when it tries to upgrade a table...
278
  $suppress_errors = $wpdb->suppress_errors(true);
@@ -288,7 +290,7 @@ class Newsletter extends NewsletterModule {
288
  PRIMARY KEY (email_id,user_id),
289
  KEY user_id (user_id),
290
  KEY email_id (email_id)
291
- ) ENGINE=MyISAM DEFAULT CHARSET=utf8;");
292
  $wpdb->suppress_errors($suppress_errors);
293
 
294
  // if ('utf8mb4' === $wpdb->charset) {
@@ -538,7 +540,7 @@ class Newsletter extends NewsletterModule {
538
  if (is_array($email)) {
539
  $email = (object) $email;
540
  }
541
-
542
  // Could be a test
543
  if (empty($email->id)) {
544
  $email->id = 0;
@@ -761,11 +763,11 @@ class Newsletter extends NewsletterModule {
761
  $this->logger->error('mail> Subject empty, skipped');
762
  return true;
763
  }
764
-
765
  if (!$headers) {
766
  $headers = array();
767
  }
768
-
769
  $headers['X-Auto-Response-Suppress'] = 'OOF, AutoReply';
770
 
771
  // Message carrige returns and line feeds clean up
@@ -1208,7 +1210,7 @@ class Newsletter extends NewsletterModule {
1208
  $text = str_replace($home . '%7B' . $tag_lower . '%7D', $url, $text);
1209
  $text = str_replace('{' . $tag_lower . '}', $url, $text);
1210
  $text = str_replace('%7B' . $tag_lower . '%7D', $url, $text);
1211
-
1212
  $text = str_replace('%7B' . $tag_lower . '_encoded%7D', urlencode($url), $text);
1213
  $text = str_replace('{' . $tag_lower . '_encoded}', urlencode($url), $text);
1214
 
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.0.6
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.0.6');
18
 
19
  global $wpdb, $newsletter;
20
 
137
  // Here because the upgrade is called by the parent constructor and uses the scheduler
138
  add_filter('cron_schedules', array($this, 'hook_cron_schedules'), 1000);
139
 
140
+ parent::__construct('main', '1.3.1');
141
 
142
  $max = $this->options['scheduler_max'];
143
  if (!is_numeric($max)) {
243
  parent::upgrade();
244
 
245
 
246
+ $sql = "CREATE TABLE `" . $wpdb->prefix . "newsletter_emails` (
247
+ `id` int(11) NOT NULL AUTO_INCREMENT,
248
+ `subject` varchar(255) NOT NULL DEFAULT '',
249
+ `message` longtext,
250
+ `subject2` varchar(255) NOT NULL DEFAULT '',
251
+ `message2` longtext,
252
+ `name2` varchar(255) NOT NULL DEFAULT '',
253
+ `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
254
+ `status` enum('new','sending','sent','paused') NOT NULL DEFAULT 'new',
255
+ `total` int(11) NOT NULL DEFAULT '0',
256
+ `last_id` int(11) NOT NULL DEFAULT '0',
257
+ `sent` int(11) NOT NULL DEFAULT '0',
258
+ `track` int(11) NOT NULL DEFAULT '0',
259
+ `list` int(11) NOT NULL DEFAULT '0',
260
+ `type` varchar(50) NOT NULL DEFAULT '',
261
+ `query` longtext,
262
+ `editor` tinyint(4) NOT NULL DEFAULT '0',
263
+ `sex` char(1) NOT NULL DEFAULT '',
264
+ `theme` varchar(50) NOT NULL DEFAULT '',
265
+ `message_text` longtext,
266
+ `preferences` longtext,
267
+ `send_on` int(11) NOT NULL DEFAULT '0',
268
+ `token` varchar(10) NOT NULL DEFAULT '',
269
+ `options` longtext,
270
+ `private` tinyint(1) NOT NULL DEFAULT '0',
271
+ `click_count` int(10) unsigned NOT NULL DEFAULT '0',
272
+ `version` varchar(10) NOT NULL DEFAULT '',
273
+ `open_count` int(10) unsigned NOT NULL DEFAULT '0',
274
+ PRIMARY KEY (`id`)
275
+ ) $charset_collate;";
276
+
277
+ dbDelta($sql);
278
 
279
  // WP does not manage composite primary key when it tries to upgrade a table...
280
  $suppress_errors = $wpdb->suppress_errors(true);
290
  PRIMARY KEY (email_id,user_id),
291
  KEY user_id (user_id),
292
  KEY email_id (email_id)
293
+ ) $charset_collate;");
294
  $wpdb->suppress_errors($suppress_errors);
295
 
296
  // if ('utf8mb4' === $wpdb->charset) {
540
  if (is_array($email)) {
541
  $email = (object) $email;
542
  }
543
+
544
  // Could be a test
545
  if (empty($email->id)) {
546
  $email->id = 0;
763
  $this->logger->error('mail> Subject empty, skipped');
764
  return true;
765
  }
766
+
767
  if (!$headers) {
768
  $headers = array();
769
  }
770
+
771
  $headers['X-Auto-Response-Suppress'] = 'OOF, AutoReply';
772
 
773
  // Message carrige returns and line feeds clean up
1210
  $text = str_replace($home . '%7B' . $tag_lower . '%7D', $url, $text);
1211
  $text = str_replace('{' . $tag_lower . '}', $url, $text);
1212
  $text = str_replace('%7B' . $tag_lower . '%7D', $url, $text);
1213
+
1214
  $text = str_replace('%7B' . $tag_lower . '_encoded%7D', urlencode($url), $text);
1215
  $text = str_replace('{' . $tag_lower . '_encoded}', urlencode($url), $text);
1216
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
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.8.1
5
- Stable tag: 5.0.5
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
@@ -85,6 +85,13 @@ Thank you, The Newsletter Team
85
 
86
  == Changelog ==
87
 
 
 
 
 
 
 
 
88
  == 5.0.5 ==
89
 
90
  * Fixed an administration notice removal
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.8.1
5
+ Stable tag: 5.0.6
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
85
 
86
  == Changelog ==
87
 
88
+ == 5.0.6 ==
89
+
90
+ * Improved performance with new db indexes
91
+ * Fixed a bug in social URLs
92
+ * Home URL check on status panel
93
+ * Fixed a not removable notice
94
+
95
  == 5.0.5 ==
96
 
97
  * Fixed an administration notice removal
statistics/statistics.php CHANGED
@@ -20,7 +20,7 @@ class NewsletterStatistics extends NewsletterModule {
20
  }
21
 
22
  function __construct() {
23
- parent::__construct('statistics', '1.1.6');
24
  add_action('wp_loaded', array($this, 'hook_wp_loaded'));
25
  if (is_admin()) {
26
  add_action('admin_enqueue_scripts', array($this, 'hook_admin_enqueue_scripts'));
@@ -165,30 +165,24 @@ class NewsletterStatistics extends NewsletterModule {
165
  global $wpdb, $charset_collate;
166
 
167
  parent::upgrade();
168
-
169
- // This before table creation or update for compatibility
170
- $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats change column newsletter_id user_id int not null default 0");
171
- $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats change column newsletter_id user_id int not null default 0");
172
- $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats change column date created timestamp not null default current_timestamp");
173
-
174
- // Just for test since it will be part of statistics module
175
- // This table stores clicks and email opens. An open is registered with a empty url.
176
- $this->upgrade_query("create table if not exists {$wpdb->prefix}newsletter_stats (id int auto_increment, primary key (id)) $charset_collate");
177
-
178
- // References
179
- $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column user_id int not null default 0");
180
- $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column email_id int not null default 0");
181
- // Future... see the links table
182
- $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column link_id int not null default 0");
183
-
184
- $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column created timestamp not null default current_timestamp");
185
- $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column url varchar(255) not null default ''");
186
- $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column anchor varchar(200) not null default ''");
187
- $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column ip varchar(20) not null default ''");
188
- $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column country varchar(4) not null default ''");
189
-
190
- $this->upgrade_query("ALTER TABLE `{$wpdb->prefix}newsletter_stats` ADD INDEX `email_id` (`email_id`)");
191
- $this->upgrade_query("ALTER TABLE `{$wpdb->prefix}newsletter_stats` ADD INDEX `user_id` (`user_id`)");
192
 
193
  if (empty($this->options['key'])) {
194
  $this->options['key'] = md5($_SERVER['REMOTE_ADDR'] . rand(100000, 999999) . time());
@@ -283,6 +277,10 @@ class NewsletterStatistics extends NewsletterModule {
283
  if ($email->status == 'sending') {
284
  return;
285
  }
 
 
 
 
286
 
287
  $count = $wpdb->get_var($wpdb->prepare("select count(*) from " . NEWSLETTER_SENT_TABLE . " where email_id=%d", $email->id));
288
 
20
  }
21
 
22
  function __construct() {
23
+ parent::__construct('statistics', '1.1.8');
24
  add_action('wp_loaded', array($this, 'hook_wp_loaded'));
25
  if (is_admin()) {
26
  add_action('admin_enqueue_scripts', array($this, 'hook_admin_enqueue_scripts'));
165
  global $wpdb, $charset_collate;
166
 
167
  parent::upgrade();
168
+
169
+ $sql = "CREATE TABLE `" . $wpdb->prefix . "newsletter_stats` (
170
+ `id` int(11) NOT NULL AUTO_INCREMENT,
171
+ `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
172
+ `url` varchar(255) NOT NULL DEFAULT '',
173
+ `newsletter` varchar(50) NOT NULL DEFAULT '',
174
+ `anchor` varchar(200) NOT NULL DEFAULT '',
175
+ `user_id` int(11) NOT NULL DEFAULT '0',
176
+ `email_id` varchar(10) NOT NULL DEFAULT '0',
177
+ `link_id` int(11) NOT NULL DEFAULT '0',
178
+ `ip` varchar(20) NOT NULL DEFAULT '',
179
+ `country` varchar(4) NOT NULL DEFAULT '',
180
+ PRIMARY KEY (`id`),
181
+ KEY `email_id` (`email_id`),
182
+ KEY `user_id` (`user_id`)
183
+ ) $charset_collate;";
184
+
185
+ dbDelta($sql);
 
 
 
 
 
 
186
 
187
  if (empty($this->options['key'])) {
188
  $this->options['key'] = md5($_SERVER['REMOTE_ADDR'] . rand(100000, 999999) . time());
277
  if ($email->status == 'sending') {
278
  return;
279
  }
280
+
281
+ if ($email->type == 'followup') {
282
+ return;
283
+ }
284
 
285
  $count = $wpdb->get_var($wpdb->prepare("select count(*) from " . NEWSLETTER_SENT_TABLE . " where email_id=%d", $email->id));
286
 
subscription/subscription.php CHANGED
@@ -1495,7 +1495,7 @@ class NewsletterSubscription extends NewsletterModule {
1495
 
1496
  if (empty($user)) {
1497
  if (empty($content)) {
1498
- return 'Subscriber profile not found.';
1499
  } else {
1500
  return $content;
1501
  }
1495
 
1496
  if (empty($user)) {
1497
  if (empty($content)) {
1498
+ return __('Subscriber profile not found.','newsletter');
1499
  } else {
1500
  return $content;
1501
  }
tnp-header.php CHANGED
@@ -167,7 +167,7 @@ if (isset($_GET['debug']) || !isset($dismissed['newsletter-wp']) && !is_plugin_a
167
 
168
  <?php
169
  $newsletter_lock_options = get_option('newsletter_lock');
170
- if (isset($_GET['debug']) || !isset($dismissed['newsletter-wp']) && !file_exists(WP_PLUGIN_DIR . '/newsletter-wp') && !empty($newsletter_lock_options['enabled'])) { ?>
171
  <div class="tnp-notice">
172
  <a href="<?php echo $_SERVER['REQUEST_URI'] . '&noheader=1&dismiss=newsletter-lock' ?>" class="tnp-dismiss">&times;</a>
173
  The <strong>Locked Content</strong> feature is now managed with a free extension. Please install it from the
167
 
168
  <?php
169
  $newsletter_lock_options = get_option('newsletter_lock');
170
+ if (isset($_GET['debug']) || !isset($dismissed['newsletter-lock']) && !file_exists(WP_PLUGIN_DIR . '/newsletter-wp') && !empty($newsletter_lock_options['enabled'])) { ?>
171
  <div class="tnp-notice">
172
  <a href="<?php echo $_SERVER['REQUEST_URI'] . '&noheader=1&dismiss=newsletter-lock' ?>" class="tnp-dismiss">&times;</a>
173
  The <strong>Locked Content</strong> feature is now managed with a free extension. Please install it from the
users/users.php CHANGED
@@ -20,7 +20,7 @@ class NewsletterUsers extends NewsletterModule {
20
  }
21
 
22
  function __construct() {
23
- parent::__construct('users', '1.0.9');
24
  add_action('init', array($this, 'hook_init'));
25
  }
26
 
@@ -84,7 +84,7 @@ class NewsletterUsers extends NewsletterModule {
84
  }
85
  // Leave as last
86
  $sql .= "`test` tinyint(4) NOT NULL DEFAULT '0',\n";
87
- $sql .= "PRIMARY KEY (`id`), UNIQUE KEY `email` (`email`)) ENGINE=MyISAM $charset_collate;";
88
 
89
  dbDelta($sql);
90
  $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " convert to character set $charset_collate");
20
  }
21
 
22
  function __construct() {
23
+ parent::__construct('users', '1.1.2');
24
  add_action('init', array($this, 'hook_init'));
25
  }
26
 
84
  }
85
  // Leave as last
86
  $sql .= "`test` tinyint(4) NOT NULL DEFAULT '0',\n";
87
+ $sql .= "PRIMARY KEY (`id`),\nUNIQUE KEY `email` (`email`),\nKEY `wp_user_id` (`wp_user_id`)\n) $charset_collate;";
88
 
89
  dbDelta($sql);
90
  $this->upgrade_query("alter table " . NEWSLETTER_USERS_TABLE . " convert to character set $charset_collate");