Newsletter - Version 5.9.4

Version Description

  • Added multi subscriber deletion
Download this release

Release Info

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

Code changes from version 5.9.3 to 5.9.4

Files changed (4) hide show
  1. includes/module.php +12 -8
  2. plugin.php +2 -2
  3. readme.txt +6 -2
  4. users/index.php +9 -1
includes/module.php CHANGED
@@ -1245,18 +1245,22 @@ class NewsletterModule {
1245
  * Deletes a subscriber and cleans up all the stats table with his correlated data.
1246
  *
1247
  * @global wpdb $wpdb
1248
- * @param int $id
1249
  */
1250
  function delete_user($id) {
1251
  global $wpdb;
1252
- $user = $this->get_user($id);
1253
- if ($user) {
1254
- $r = $this->store->delete(NEWSLETTER_USERS_TABLE, $id);
1255
- do_action('newsletter_user_deleted', $user);
 
 
 
 
 
1256
  }
1257
- // Anyway try a table clean up, nothing bad happens
1258
- $wpdb->delete(NEWSLETTER_STATS_TABLE, array('user_id' => $id));
1259
- $wpdb->delete(NEWSLETTER_SENT_TABLE, array('user_id' => $id));
1260
  }
1261
 
1262
  /**
1245
  * Deletes a subscriber and cleans up all the stats table with his correlated data.
1246
  *
1247
  * @global wpdb $wpdb
1248
+ * @param int|id[] $id
1249
  */
1250
  function delete_user($id) {
1251
  global $wpdb;
1252
+ $id = (array) $id;
1253
+ foreach ($id as $user_id) {
1254
+ $user = $this->get_user($user_id);
1255
+ if ($user) {
1256
+ $r = $this->store->delete(NEWSLETTER_USERS_TABLE, $user_id);
1257
+ $wpdb->delete(NEWSLETTER_STATS_TABLE, array('user_id' => $user_id));
1258
+ $wpdb->delete(NEWSLETTER_SENT_TABLE, array('user_id' => $user_id));
1259
+ do_action('newsletter_user_deleted', $user);
1260
+ }
1261
  }
1262
+
1263
+ return count($id);
 
1264
  }
1265
 
1266
  /**
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.9.3
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.9.3');
33
 
34
  global $newsletter, $wpdb;
35
 
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.9.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.
29
  */
30
 
31
  // Used as dummy parameter on css and js links
32
+ define('NEWSLETTER_VERSION', '5.9.4');
33
 
34
  global $newsletter, $wpdb;
35
 
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.1.1
5
- Stable tag: 5.9.3
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,10 @@ Thank you, The Newsletter Team
122
 
123
  == Changelog ==
124
 
 
 
 
 
125
  = 5.9.3 =
126
 
127
  * Fixed multi newsletter deletion warning
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.2
5
+ Stable tag: 5.9.4
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.9.4 =
126
+
127
+ * Added multi subscriber deletion
128
+
129
  = 5.9.3 =
130
 
131
  * Fixed multi newsletter deletion warning
users/index.php CHANGED
@@ -41,6 +41,11 @@ if ($controls->is_action('remove')) {
41
  unset($controls->data['subscriber_id']);
42
  }
43
 
 
 
 
 
 
44
  // We build the query condition
45
  $where = 'where 1=1';
46
  $query_args = array();
@@ -152,12 +157,15 @@ $controls->data['search_page'] ++;
152
  <?php $controls->button('last', '»'); ?>
153
 
154
  <?php echo $count ?> <?php _e('subscriber(s) found', 'newsletter') ?>
 
 
155
 
156
  </div>
157
 
158
  <table class="widefat">
159
  <thead>
160
  <tr>
 
161
  <th>Id</th>
162
  <th>Email</th>
163
  <th><?php _e('Name', 'newsletter') ?></th>
@@ -173,7 +181,7 @@ $controls->data['search_page'] ++;
173
  <?php $i = 0; ?>
174
  <?php foreach ($list as $s) { ?>
175
  <tr class="<?php echo ($i++ % 2 == 0) ? 'alternate' : ''; ?>">
176
-
177
  <td>
178
  <?php echo $s->id; ?>
179
  </td>
41
  unset($controls->data['subscriber_id']);
42
  }
43
 
44
+ if ($controls->is_action('delete_selected')) {
45
+ $r = Newsletter::instance()->delete_user($_POST['ids']);
46
+ $controls->messages .= $r . ' user(s) deleted';
47
+ }
48
+
49
  // We build the query condition
50
  $where = 'where 1=1';
51
  $query_args = array();
157
  <?php $controls->button('last', '»'); ?>
158
 
159
  <?php echo $count ?> <?php _e('subscriber(s) found', 'newsletter') ?>
160
+
161
+ <?php $controls->button_confirm('delete_selected', __('Delete selected', 'newsletter')); ?>
162
 
163
  </div>
164
 
165
  <table class="widefat">
166
  <thead>
167
  <tr>
168
+ <th><input type="checkbox" onchange="jQuery('input.tnp-selector').prop('checked', this.checked)"</th>
169
  <th>Id</th>
170
  <th>Email</th>
171
  <th><?php _e('Name', 'newsletter') ?></th>
181
  <?php $i = 0; ?>
182
  <?php foreach ($list as $s) { ?>
183
  <tr class="<?php echo ($i++ % 2 == 0) ? 'alternate' : ''; ?>">
184
+ <td><input class="tnp-selector" type="checkbox" name="ids[]" value="<?php echo $s->id; ?>"/></td>
185
  <td>
186
  <?php echo $s->id; ?>
187
  </td>