Newsletter - Version 5.8.6

Version Description

  • Improved geolocation support
  • Improved composer image block
Download this release

Release Info

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

Code changes from version 5.8.5 to 5.8.6

emails/tnp-composer/_scripts/newsletter-builder.js CHANGED
@@ -25,6 +25,7 @@ jQuery.fn.hover_edit = function () {
25
  jQuery(this).parent().parent().slideUp(500)
26
  target.find('img').attr("src", jQuery("#tnpc-edit-image .image").val());
27
  target.find('img').attr("alt", jQuery("#tnpc-edit-image .alt").val());
 
28
  target.find('a').attr("href", jQuery("#tnpc-edit-image .url").val());
29
  tnp_mobile_preview();
30
  });
25
  jQuery(this).parent().parent().slideUp(500)
26
  target.find('img').attr("src", jQuery("#tnpc-edit-image .image").val());
27
  target.find('img').attr("alt", jQuery("#tnpc-edit-image .alt").val());
28
+ target.find('img').attr("width", jQuery("#tnpc-edit-image .width").val());
29
  target.find('a').attr("href", jQuery("#tnpc-edit-image .url").val());
30
  tnp_mobile_preview();
31
  });
emails/tnp-composer/edit.php CHANGED
@@ -10,6 +10,8 @@ if (!defined('ABSPATH')) exit;
10
  <input type="text" class="tnpc-edit-box-content-field-input image"/>
11
  <input class="button select_image" value="Select or Upload Image" type="button">
12
  </div>
 
 
13
  <div class="tnpc-edit-box-content-text"><?php _e("ALT TEXT", "newsletter") ?><span>(optional but recommended)</span></div>
14
  <div class="tnpc-edit-box-content-field"><input type="text" class="tnpc-edit-box-content-field-input alt"/></div>
15
  <div class="tnpc-edit-box-content-text"><?php _e("LINK", "newsletter") ?> <span>(optional link address including http://)</span></div>
@@ -34,7 +36,7 @@ if (!defined('ABSPATH')) exit;
34
  file_frame = wp.media.frames.file_frame = wp.media({
35
  title: jQuery('#tnpc-edit-image .image').val(),
36
  button: {
37
- text: 'Insert',
38
  },
39
  multiple: false // Set to true to allow multiple files to be selected
40
  });
10
  <input type="text" class="tnpc-edit-box-content-field-input image"/>
11
  <input class="button select_image" value="Select or Upload Image" type="button">
12
  </div>
13
+ <div class="tnpc-edit-box-content-text"><?php _e("WIDTH", "newsletter") ?><span>(optional but recommended)</span></div>
14
+ <div class="tnpc-edit-box-content-field"><input type="text" class="tnpc-edit-box-content-field-input width"/></div>
15
  <div class="tnpc-edit-box-content-text"><?php _e("ALT TEXT", "newsletter") ?><span>(optional but recommended)</span></div>
16
  <div class="tnpc-edit-box-content-field"><input type="text" class="tnpc-edit-box-content-field-input alt"/></div>
17
  <div class="tnpc-edit-box-content-text"><?php _e("LINK", "newsletter") ?> <span>(optional link address including http://)</span></div>
36
  file_frame = wp.media.frames.file_frame = wp.media({
37
  title: jQuery('#tnpc-edit-image .image').val(),
38
  button: {
39
+ text: '',
40
  },
41
  multiple: false // Set to true to allow multiple files to be selected
42
  });
includes/module.php CHANGED
@@ -171,6 +171,7 @@ class NewsletterModule {
171
  if ($r === false) {
172
  $this->logger->fatal($wpdb->last_error);
173
  }
 
174
  }
175
 
176
  /**
@@ -1156,10 +1157,10 @@ class NewsletterModule {
1156
  $this->query($wpdb->prepare("update " . NEWSLETTER_USERS_TABLE . " set last_activity=%d where id=%d limit 1", time(), $user->id));
1157
  }
1158
 
1159
- function update_user_last_ip($user, $ip) {
1160
  global $wpdb;
1161
  // Only if changed
1162
- $this->query($wpdb->prepare("update " . NEWSLETTER_USERS_TABLE . " set country='', last_ip=%s where last_ip<>%s and id=%d limit 1", $ip, $ip, $user->id));
1163
  }
1164
 
1165
  /**
171
  if ($r === false) {
172
  $this->logger->fatal($wpdb->last_error);
173
  }
174
+ return $r;
175
  }
176
 
177
  /**
1157
  $this->query($wpdb->prepare("update " . NEWSLETTER_USERS_TABLE . " set last_activity=%d where id=%d limit 1", time(), $user->id));
1158
  }
1159
 
1160
+ function update_user_ip($user, $ip) {
1161
  global $wpdb;
1162
  // Only if changed
1163
+ $r = $this->query($wpdb->prepare("update " . NEWSLETTER_USERS_TABLE . " set ip=%s, geo=0 where ip<>%s and id=%d limit 1", $ip, $ip, $user->id));
1164
  }
1165
 
1166
  /**
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.8.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.
@@ -29,7 +29,7 @@
29
  */
30
 
31
  // Used as dummy parameter on css and js links
32
- define('NEWSLETTER_VERSION', '5.8.5');
33
 
34
  global $newsletter, $wpdb;
35
 
@@ -1189,6 +1189,9 @@ class Newsletter extends NewsletterModule {
1189
  * @since 1.0.0
1190
  */
1191
  function hook_plugins_loaded() {
 
 
 
1192
  if (function_exists('load_plugin_textdomain')) {
1193
  load_plugin_textdomain('newsletter', false, plugin_basename(dirname(__FILE__)) . '/languages');
1194
  }
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.8.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.
29
  */
30
 
31
  // Used as dummy parameter on css and js links
32
+ define('NEWSLETTER_VERSION', '5.8.6');
33
 
34
  global $newsletter, $wpdb;
35
 
1189
  * @since 1.0.0
1190
  */
1191
  function hook_plugins_loaded() {
1192
+
1193
+ //do_action('newsletter_loaded', NEWSLETTER_VERSION);
1194
+
1195
  if (function_exists('load_plugin_textdomain')) {
1196
  load_plugin_textdomain('newsletter', false, plugin_basename(dirname(__FILE__)) . '/languages');
1197
  }
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: 5.0.1
5
- Stable tag: 5.8.5
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
@@ -122,6 +122,11 @@ Thank you, The Newsletter Team
122
 
123
  == Changelog ==
124
 
 
 
 
 
 
125
  = 5.8.5 =
126
 
127
  * Reverted back to select2 3.x
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: 5.0.2
5
+ Stable tag: 5.8.6
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
122
 
123
  == Changelog ==
124
 
125
+ = 5.8.6 =
126
+
127
+ * Improved geolocation support
128
+ * Improved composer image block
129
+
130
  = 5.8.5 =
131
 
132
  * Reverted back to select2 3.x
statistics/css/tnp-statistics.css CHANGED
@@ -122,7 +122,7 @@
122
  #tnp-events-chart {
123
  width: 80%;
124
  margin: 0 auto;
125
-
126
  }
127
 
128
  /* Retarget Table Layout */
@@ -137,4 +137,8 @@
137
  border: none;
138
  }
139
 
 
 
 
 
140
 
122
  #tnp-events-chart {
123
  width: 80%;
124
  margin: 0 auto;
125
+ height: 300px;
126
  }
127
 
128
  /* Retarget Table Layout */
137
  border: none;
138
  }
139
 
140
+ #tnp-body.tnp-statistics .tnp-widget {
141
+ min-height: 500px;
142
+ }
143
+
144
 
statistics/index.php CHANGED
@@ -94,7 +94,7 @@ $overview_click_rate = array_reverse($overview_click_rate);
94
 
95
  </div>
96
 
97
- <div id="tnp-body">
98
  <form method="post" action="">
99
 
100
  <?php $controls->init(); ?>
94
 
95
  </div>
96
 
97
+ <div id="tnp-body" class="tnp-statistics">
98
  <form method="post" action="">
99
 
100
  <?php $controls->init(); ?>
statistics/statistics.php CHANGED
@@ -102,7 +102,7 @@ class NewsletterStatistics extends NewsletterModule {
102
  $this->update_open_value(self::SENT_READ, $user_id, $email_id, $ip);
103
  }
104
 
105
- $this->update_user_last_ip($user, $ip);
106
  $this->update_user_last_activity($user);
107
 
108
  header('Location: ' . apply_filters('newsletter_redirect_url', $url, $email, $user));
102
  $this->update_open_value(self::SENT_READ, $user_id, $email_id, $ip);
103
  }
104
 
105
+ $this->update_user_ip($user, $ip);
106
  $this->update_user_last_activity($user);
107
 
108
  header('Location: ' . apply_filters('newsletter_redirect_url', $url, $email, $user));
subscription/subscription.php CHANGED
@@ -581,7 +581,7 @@ class NewsletterSubscription extends NewsletterModule {
581
 
582
  $id = (int) $id;
583
 
584
- $wpdb->update(NEWSLETTER_USERS_TABLE, array('updated' => $time, 'ip' => $ip), array('id' => $id));
585
  }
586
 
587
  /**
@@ -695,6 +695,7 @@ class NewsletterSubscription extends NewsletterModule {
695
  $ip = $this->get_remote_ip();
696
  $ip = $this->process_ip($ip);
697
  $user['ip'] = $ip;
 
698
  $user['status'] = $opt_in == self::OPTIN_SINGLE ? Newsletter::STATUS_CONFIRMED : Newsletter::STATUS_NOT_CONFIRMED;
699
 
700
  $user['updated'] = time();
581
 
582
  $id = (int) $id;
583
 
584
+ $wpdb->update(NEWSLETTER_USERS_TABLE, array('updated' => $time, 'ip' => $ip, 'geo'=>0), array('id' => $id));
585
  }
586
 
587
  /**
695
  $ip = $this->get_remote_ip();
696
  $ip = $this->process_ip($ip);
697
  $user['ip'] = $ip;
698
+ $user['geo'] = 0;
699
  $user['status'] = $opt_in == self::OPTIN_SINGLE ? Newsletter::STATUS_CONFIRMED : Newsletter::STATUS_NOT_CONFIRMED;
700
 
701
  $user['updated'] = time();
users/edit.php CHANGED
@@ -240,7 +240,6 @@ function percentValue($value, $total) {
240
  <th><?php _e('IP address', 'newsletter'); ?></th>
241
  <td>
242
  <?php $controls->value('ip'); ?>
243
- last seen: <?php $controls->value('last_ip'); ?>
244
  </td>
245
  </tr>
246
  <tr>
240
  <th><?php _e('IP address', 'newsletter'); ?></th>
241
  <td>
242
  <?php $controls->value('ip'); ?>
 
243
  </td>
244
  </tr>
245
  <tr>
users/index.php CHANGED
@@ -114,7 +114,7 @@ $controls->data['search_page'] ++;
114
  <div id="tnp-heading">
115
 
116
  <h2><?php _e('Subscribers', 'newsletter') ?>
117
- <a class="tnp-btn-h1" href="?page=newsletter_users_new">+</a>
118
  </h2>
119
 
120
  </div>
114
  <div id="tnp-heading">
115
 
116
  <h2><?php _e('Subscribers', 'newsletter') ?>
117
+ <a class="tnp-btn-h1" href="?page=newsletter_users_new">Add a subscriber</a>
118
  </h2>
119
 
120
  </div>
users/users.php CHANGED
@@ -19,7 +19,7 @@ class NewsletterUsers extends NewsletterModule {
19
  }
20
 
21
  function __construct() {
22
- parent::__construct('users', '1.2.6');
23
  add_action('init', array($this, 'hook_init'));
24
  }
25
 
@@ -69,9 +69,9 @@ class NewsletterUsers extends NewsletterModule {
69
  `feed` tinyint(4) NOT NULL DEFAULT '0',
70
  `referrer` varchar(50) NOT NULL DEFAULT '',
71
  `ip` varchar(50) NOT NULL DEFAULT '',
72
- `last_ip` varchar(50) NOT NULL DEFAULT '',
73
  `wp_user_id` int(11) NOT NULL DEFAULT '0',
74
  `http_referer` varchar(255) NOT NULL DEFAULT '',
 
75
  `country` varchar(4) NOT NULL DEFAULT '',
76
  `region` varchar(100) NOT NULL DEFAULT '',
77
  `city` varchar(100) NOT NULL DEFAULT '',
@@ -93,7 +93,14 @@ class NewsletterUsers extends NewsletterModule {
93
 
94
  dbDelta($sql);
95
 
96
- $this->query("update " . NEWSLETTER_USERS_TABLE . " set last_ip=ip where last_ip=''");
 
 
 
 
 
 
 
97
  }
98
 
99
  function admin_menu() {
19
  }
20
 
21
  function __construct() {
22
+ parent::__construct('users', '1.2.9');
23
  add_action('init', array($this, 'hook_init'));
24
  }
25
 
69
  `feed` tinyint(4) NOT NULL DEFAULT '0',
70
  `referrer` varchar(50) NOT NULL DEFAULT '',
71
  `ip` varchar(50) NOT NULL DEFAULT '',
 
72
  `wp_user_id` int(11) NOT NULL DEFAULT '0',
73
  `http_referer` varchar(255) NOT NULL DEFAULT '',
74
+ `geo` tinyint(4) NOT NULL DEFAULT '0',
75
  `country` varchar(4) NOT NULL DEFAULT '',
76
  `region` varchar(100) NOT NULL DEFAULT '',
77
  `city` varchar(100) NOT NULL DEFAULT '',
93
 
94
  dbDelta($sql);
95
 
96
+ if ($this->old_version < '1.2.7') {
97
+ $this->query("update " . NEWSLETTER_USERS_TABLE . " set geo=1 where country<>''");
98
+
99
+ }
100
+ if ($this->old_version > '1.2.5' && $this->old_version < '1.2.9') {
101
+ $this->upgrade_query("ALTER TABLE " . NEWSLETTER_USERS_TABLE . " DROP COLUMN last_ip;");
102
+ }
103
+
104
  }
105
 
106
  function admin_menu() {