Newsletter - Version 3.3.0

Version Description

  • Fixed a replacement on online email version
  • Fixed a missing privacy check box configuration
  • Improved the split posts
  • Added post_type control
  • Re-enabled the subscription for addresses not confirmed
  • Fixed the welcome and ocnfirmaiton email when sent from subscribers list panel (were not using the theme)
  • Added the "pre-checked" option to preferences configuration
Download this release

Release Info

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

Code changes from version 3.2.9 to 3.3.0

do/view.php CHANGED
@@ -16,5 +16,5 @@ if (is_file(WP_CONTENT_DIR . '/extensions/newsletter/view.php')) {
16
  die();
17
  }
18
 
19
- echo $newsletter->replace($email->message, $user);
20
  ?>
16
  die();
17
  }
18
 
19
+ echo $newsletter->replace($email->message, $user, $email->id);
20
  ?>
emails/new.php CHANGED
@@ -112,13 +112,14 @@ function newsletter_emails_get_theme_options($theme) {
112
 
113
  <div id="tabs">
114
  <ul>
115
- <li><a href="#tabs-1">Theme options</a></li>
116
  <li><a href="#tabs-2">Preview</a></li>
 
117
  <li><a href="#tabs-3">Preview (textual)</a></li>
118
  </ul>
119
 
120
 
121
  <div id="tabs-1">
 
122
  <?php @include $module->get_current_theme_file_path('theme-options.php');?>
123
  <div class="newsletter-buttons newsletter-buttons-bottom">
124
  <?php $controls->button('save', 'Save options and refresh'); ?>
112
 
113
  <div id="tabs">
114
  <ul>
 
115
  <li><a href="#tabs-2">Preview</a></li>
116
+ <li><a href="#tabs-1">Theme options</a></li>
117
  <li><a href="#tabs-3">Preview (textual)</a></li>
118
  </ul>
119
 
120
 
121
  <div id="tabs-1">
122
+ <p>Theme options are saved for next time you'll use it!</p>
123
  <?php @include $module->get_current_theme_file_path('theme-options.php');?>
124
  <div class="newsletter-buttons newsletter-buttons-bottom">
125
  <?php $controls->button('save', 'Save options and refresh'); ?>
emails/themes/default/theme-options.php CHANGED
@@ -2,6 +2,14 @@
2
  <tr>
3
  <th>Base color</th>
4
  <td><?php $controls->color('theme_color'); ?></td>
 
 
 
 
 
 
 
 
5
  </tr>
6
  <tr>
7
  <th>Add latest posts</th>
2
  <tr>
3
  <th>Base color</th>
4
  <td><?php $controls->color('theme_color'); ?></td>
5
+ </tr>
6
+ <tr>
7
+ <th>Banner</th>
8
+ <td><?php $controls->wp_editor('theme_banner'); ?>
9
+ <div class="hints">
10
+ Create a content with an image (500 pixel wide) that will be your newsletter banner.
11
+ </div>
12
+ </td>
13
  </tr>
14
  <tr>
15
  <th>Add latest posts</th>
emails/themes/default/theme.php CHANGED
@@ -15,6 +15,7 @@ if (empty($color)) $color = '#0088cc';
15
 
16
  if (isset($theme_options['theme_posts'])) $posts = get_posts(array('showposts'=>10));
17
 
 
18
  ?><!DOCTYPE html>
19
  <html>
20
  <head>
@@ -32,9 +33,11 @@ if (isset($theme_options['theme_posts'])) $posts = get_posts(array('showposts'=>
32
  <tr>
33
  <td style="font-family: Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 14px; color: #666;">
34
  <div style="text-align: left; max-width: 500px; border-top: 10px solid <?php echo $color; ?>; border-bottom: 3px solid <?php echo $color; ?>;">
 
35
  <div style="padding: 10px 20px; color: #000; font-size: 20px; background-color: #EFEFEF; border-bottom: 1px solid #ddd">
36
  <?php echo get_option('blogname'); ?>
37
  </div>
 
38
  <div style="padding: 20px; background-color: #fff; line-height: 18px">
39
 
40
  <p style="text-align: center"><a target="_blank" href="{email_url}">View this email online</a></p>
15
 
16
  if (isset($theme_options['theme_posts'])) $posts = get_posts(array('showposts'=>10));
17
 
18
+
19
  ?><!DOCTYPE html>
20
  <html>
21
  <head>
33
  <tr>
34
  <td style="font-family: Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 14px; color: #666;">
35
  <div style="text-align: left; max-width: 500px; border-top: 10px solid <?php echo $color; ?>; border-bottom: 3px solid <?php echo $color; ?>;">
36
+
37
  <div style="padding: 10px 20px; color: #000; font-size: 20px; background-color: #EFEFEF; border-bottom: 1px solid #ddd">
38
  <?php echo get_option('blogname'); ?>
39
  </div>
40
+
41
  <div style="padding: 20px; background-color: #fff; line-height: 18px">
42
 
43
  <p style="text-align: center"><a target="_blank" href="{email_url}">View this email online</a></p>
includes/controls.php CHANGED
@@ -149,6 +149,18 @@ class NewsletterControls {
149
  echo "</div><div style='clear: both'></div>";
150
  }
151
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  function select_group($name, $options) {
153
  echo '<select name="options[' . $name . '][]">';
154
 
149
  echo "</div><div style='clear: both'></div>";
150
  }
151
 
152
+ /** Creates a checkbox group with all public post types.
153
+ */
154
+ function post_types($name = 'post_types') {
155
+ $list = array();
156
+ $post_types = get_post_types(array('public' => true), 'objects', 'and');
157
+ foreach ($post_types as &$post_type) {
158
+ $list[$post_type->name] = $post_type->labels->name;
159
+ }
160
+
161
+ $this->checkboxes_group('post_types', $list);
162
+ }
163
+
164
  function select_group($name, $options) {
165
  echo '<select name="options[' . $name . '][]">';
166
 
includes/module.php CHANGED
@@ -399,6 +399,10 @@ class NewsletterModule {
399
  * @param int $time
400
  */
401
  static function split_posts(&$posts, $time = 0) {
 
 
 
 
402
  $result = array(array(), array());
403
  foreach ($posts as &$post) {
404
  if (self::is_post_old($post, $time))
399
  * @param int $time
400
  */
401
  static function split_posts(&$posts, $time = 0) {
402
+ if ($last_run < 0) {
403
+ return array_chunk($posts, ceil(count($posts)/2));
404
+ }
405
+
406
  $result = array(array(), array());
407
  foreach ($posts as &$post) {
408
  if (self::is_post_old($post, $time))
plugin.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Newsletter
5
  Plugin URI: http://www.satollo.net/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="http://www.satollo.net/plugins/newsletter#update">this page</a> to know what's changed.</strong>
7
- Version: 3.2.9
8
  Author: Stefano Lissa
9
  Author URI: http://www.satollo.net
10
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
@@ -13,7 +13,7 @@
13
  */
14
 
15
  // Useed as dummy parameter on css and js links
16
- define('NEWSLETTER_VERSION', '3.2.9');
17
 
18
  global $wpdb, $newsletter;
19
 
4
  Plugin Name: Newsletter
5
  Plugin URI: http://www.satollo.net/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="http://www.satollo.net/plugins/newsletter#update">this page</a> to know what's changed.</strong>
7
+ Version: 3.3.0
8
  Author: Stefano Lissa
9
  Author URI: http://www.satollo.net
10
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
13
  */
14
 
15
  // Useed as dummy parameter on css and js links
16
+ define('NEWSLETTER_VERSION', '3.3.0');
17
 
18
  global $wpdb, $newsletter;
19
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing
3
  Requires at least: 3.3.0
4
  Tested up to: 3.5.1
5
- Stable tag: 3.2.9
6
  Donate link: http://www.satollo.net/donations
7
 
8
  Add a real newsletter to your blog. In seconds. For free. With unlimited emails and subscribers.
@@ -55,6 +55,16 @@ No screen shots are available at this time.
55
 
56
  == Changelog ==
57
 
 
 
 
 
 
 
 
 
 
 
58
  = 3.2.9 =
59
 
60
  * Fixed a possible loop on widget (when using extended fields in combobox format)
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing
3
  Requires at least: 3.3.0
4
  Tested up to: 3.5.1
5
+ Stable tag: 3.3.0
6
  Donate link: http://www.satollo.net/donations
7
 
8
  Add a real newsletter to your blog. In seconds. For free. With unlimited emails and subscribers.
55
 
56
  == Changelog ==
57
 
58
+ = 3.3.0 =
59
+
60
+ * Fixed a replacement on online email version
61
+ * Fixed a missing privacy check box configuration
62
+ * Improved the split posts
63
+ * Added post_type control
64
+ * Re-enabled the subscription for addresses not confirmed
65
+ * Fixed the welcome and ocnfirmaiton email when sent from subscribers list panel (were not using the theme)
66
+ * Added the "pre-checked" option to preferences configuration
67
+
68
  = 3.2.9 =
69
 
70
  * Fixed a possible loop on widget (when using extended fields in combobox format)
subscription/profile.php CHANGED
@@ -154,6 +154,7 @@ $rules = array(0=>'Optional', 1=>'Required');
154
  <th>Privacy check box</th>
155
  <td>
156
  <table class="newsletter-option-grid">
 
157
  <tr><th>Label</th><td><?php $controls->text('privacy', 50); ?></td></tr>
158
  <tr><th>Error message</th><td><?php $controls->text('privacy_error', 50); ?></td></tr>
159
  <tr><th>Privacy URL</th><td><?php $controls->text('privacy_url', 50); ?></td></tr>
@@ -213,11 +214,19 @@ $rules = array(0=>'Optional', 1=>'Required');
213
  <table class="widefat">
214
  <thead>
215
  <tr>
216
- <th>Field</th><th>When/Where</th><th>Configuration</th>
 
 
 
217
  </tr>
218
  </thead>
219
  <?php for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) { ?>
220
- <tr><td>Preference <?php echo $i; ?></td><td><?php $controls->select('list_' . $i . '_status', $status); ?></td><td>label: <?php $controls->text('list_' . $i); ?></td></tr>
 
 
 
 
 
221
  <?php } ?>
222
  </table>
223
  <div class="hints">
154
  <th>Privacy check box</th>
155
  <td>
156
  <table class="newsletter-option-grid">
157
+ <tr><th>Enabled?</th><?php $controls->yesno('privacy_status'); ?></td></tr>
158
  <tr><th>Label</th><td><?php $controls->text('privacy', 50); ?></td></tr>
159
  <tr><th>Error message</th><td><?php $controls->text('privacy_error', 50); ?></td></tr>
160
  <tr><th>Privacy URL</th><td><?php $controls->text('privacy_url', 50); ?></td></tr>
214
  <table class="widefat">
215
  <thead>
216
  <tr>
217
+ <th>Field</th>
218
+ <th>When/Where</th>
219
+ <th>Name</th>
220
+ <th>&nbsp;</th>
221
  </tr>
222
  </thead>
223
  <?php for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) { ?>
224
+ <tr>
225
+ <td>Preference <?php echo $i; ?></td>
226
+ <td><?php $controls->select('list_' . $i . '_status', $status); ?></td>
227
+ <td><?php $controls->text('list_' . $i); ?></td>
228
+ <td><?php $controls->select('list_' . $i . '_checked', array(0=>'Uncheked', 1=>'Checked')); ?></td>
229
+ </tr>
230
  <?php } ?>
231
  </table>
232
  <div class="hints">
subscription/subscription.php CHANGED
@@ -195,7 +195,7 @@ class NewsletterSubscription extends NewsletterModule {
195
  $user = $newsletter->get_user($email);
196
 
197
  if ($user != null) {
198
- if ($user->status == 'B' || $user->status == 'C' || $user->status == 'S') {
199
  $this->logger->error('Subscription of an address with status ' . $user->status);
200
  $user->status = 'E';
201
  return $user;
@@ -654,7 +654,9 @@ class NewsletterSubscription extends NewsletterModule {
654
  for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
655
  if ($options_profile['list_' . $i . '_status'] != 2)
656
  continue;
657
- $lists .= "\t\t" . '<input type="checkbox" name="nl[]" value="' . $i . '"/>&nbsp;' . $options_profile['list_' . $i] . '<br />' . "\n";
 
 
658
  }
659
  if (!empty($lists))
660
  $buffer .= "<!-- preferences -->\n<tr>\n\t<th>&nbsp;</th>\n\t<td>\n" . $lists . "\t</td>\n</tr>\n\n";
195
  $user = $newsletter->get_user($email);
196
 
197
  if ($user != null) {
198
+ if ($user->status == 'B' || $user->status == 'C') {
199
  $this->logger->error('Subscription of an address with status ' . $user->status);
200
  $user->status = 'E';
201
  return $user;
654
  for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
655
  if ($options_profile['list_' . $i . '_status'] != 2)
656
  continue;
657
+ $lists .= "\t\t" . '<input type="checkbox" name="nl[]" value="' . $i . '"';
658
+ if ($options_profile['list_' . $i . '_checked'] == 1) $lists .= ' checked';
659
+ $lists .= '/>&nbsp;' . $options_profile['list_' . $i] . '<br />' . "\n";
660
  }
661
  if (!empty($lists))
662
  $buffer .= "<!-- preferences -->\n<tr>\n\t<th>&nbsp;</th>\n\t<td>\n" . $lists . "\t</td>\n</tr>\n\n";
users/index.php CHANGED
@@ -20,14 +20,14 @@ for ($i=1; $i<=NEWSLETTER_LIST_MAX; $i++)
20
  if ($controls->is_action('resend')) {
21
  $user = NewsletterUsers::instance()->get_user($controls->button_data);
22
  $opts = get_option('newsletter');
23
- $newsletter->mail($user->email, $newsletter->replace($opts['confirmation_subject'], $user), $newsletter->replace($opts['confirmation_message'], $user));
24
  $controls->messages = 'Activation email resent to ' . $user->email;
25
  }
26
 
27
  if ($controls->is_action('resend_welcome')) {
28
  $user = NewsletterUsers::instance()->get_user($controls->button_data);
29
  $opts = get_option('newsletter');
30
- $newsletter->mail($user->email, $newsletter->replace($opts['confirmed_subject'], $user), $newsletter->replace($opts['confirmed_message'], $user));
31
  $controls->messages = 'Welcome email resent.';
32
  }
33
 
20
  if ($controls->is_action('resend')) {
21
  $user = NewsletterUsers::instance()->get_user($controls->button_data);
22
  $opts = get_option('newsletter');
23
+ NewsletterSubscription::instance()->mail($user->email, $newsletter->replace($opts['confirmation_subject'], $user), $newsletter->replace($opts['confirmation_message'], $user));
24
  $controls->messages = 'Activation email resent to ' . $user->email;
25
  }
26
 
27
  if ($controls->is_action('resend_welcome')) {
28
  $user = NewsletterUsers::instance()->get_user($controls->button_data);
29
  $opts = get_option('newsletter');
30
+ NewsletterSubscription::instance()->mail($user->email, $newsletter->replace($opts['confirmed_subject'], $user), $newsletter->replace($opts['confirmed_message'], $user));
31
  $controls->messages = 'Welcome email resent.';
32
  }
33
 
widget.php CHANGED
@@ -63,7 +63,9 @@ class NewsletterWidget extends WP_Widget {
63
  $lists = '';
64
  for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
65
  if ($options_profile['list_' . $i . '_status'] != 2) continue;
66
- $lists .= '<input type="checkbox" name="nl[]" value="' . $i . '"/>&nbsp;' . $options_profile['list_' . $i] . '<br />';
 
 
67
  }
68
  if (!empty($lists)) $form .= '<p>' . $lists . '</p>';
69
 
63
  $lists = '';
64
  for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
65
  if ($options_profile['list_' . $i . '_status'] != 2) continue;
66
+ $lists .= '<input type="checkbox" name="nl[]" value="' . $i . '"';
67
+ if ($options_profile['list_' . $i . '_checked'] == 1) $lists .= ' checked';
68
+ $lists .= '/>&nbsp;' . $options_profile['list_' . $i] . '<br />';
69
  }
70
  if (!empty($lists)) $form .= '<p>' . $lists . '</p>';
71