Newsletter - Version 4.6.3

Version Description

  • Fixed the profile save with new action url
Download this release

Release Info

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

Code changes from version 4.6.2 to 4.6.3

Files changed (3) hide show
  1. plugin.php +2 -2
  2. readme.txt +5 -1
  3. subscription/subscription.php +51 -48
plugin.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Newsletter
5
  Plugin URI: http://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="http://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
7
- Version: 4.6.2
8
  Author: Stefano Lissa & The Newsletter Team
9
  Author URI: http://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', '4.6.2');
18
 
19
  global $wpdb, $newsletter;
20
 
4
  Plugin Name: Newsletter
5
  Plugin URI: http://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="http://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
7
+ Version: 4.6.3
8
  Author: Stefano Lissa & The Newsletter Team
9
  Author URI: http://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', '4.6.3');
18
 
19
  global $wpdb, $newsletter;
20
 
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.6.1
5
- Stable tag: 4.6.1
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
@@ -77,6 +77,10 @@ Thank you, The Newsletter Team
77
 
78
  == Changelog ==
79
 
 
 
 
 
80
  = 4.6.2 =
81
 
82
  * Fixed the import option "override status" not working in update mode
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.6.1
5
+ Stable tag: 4.6.3
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
77
 
78
  == Changelog ==
79
 
80
+ = 4.6.3 =
81
+
82
+ * Fixed the profile save with new action url
83
+
84
  = 4.6.2 =
85
 
86
  * Fixed the import option "override status" not working in update mode
subscription/subscription.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
- if (!defined('ABSPATH')) exit;
 
 
3
 
4
  require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
5
 
@@ -25,9 +27,7 @@ class NewsletterSubscription extends NewsletterModule {
25
  parent::__construct('subscription', '2.0.2');
26
 
27
  // $this->options_lock = $this->get_options('lock');
28
-
29
  //add_action('wp_login', array($this, 'hook_wp_login'));
30
-
31
  // Must be called after the Newsletter::hook_init, since some constants are defined
32
  // there.
33
  add_action('init', array($this, 'hook_init'), 90);
@@ -57,40 +57,40 @@ class NewsletterSubscription extends NewsletterModule {
57
  switch ($newsletter->action) {
58
  case 's':
59
 
60
- if (isset($this->options['antibot_disable']) || NewsletterModule::antibot_form_check()) {
61
 
62
- $user = NewsletterSubscription::instance()->subscribe();
63
 
64
  if ($user->status == 'E')
65
- NewsletterSubscription::instance()->show_message('error', $user->id);
66
  if ($user->status == 'C')
67
- NewsletterSubscription::instance()->show_message('confirmed', $user->id);
68
  if ($user->status == 'A')
69
- NewsletterSubscription::instance()->show_message('already_confirmed', $user->id);
70
  if ($user->status == 'S')
71
- NewsletterSubscription::instance()->show_message('confirmation', $user->id);
72
  } else {
73
 
74
- NewsletterModule::request_to_antibot_form('Subscribe');
75
  }
76
  die();
77
  case 'u':
78
- $user = NewsletterSubscription::instance()->get_user_from_request();
79
  $email = $this->get_email_from_request();
80
  if ($user == null) {
81
- NewsletterSubscription::instance()->show_message('unsubscription_error', null);
82
  } else {
83
- NewsletterSubscription::instance()->show_message('unsubscription', $user, null, $email);
84
  }
85
  die();
86
  break;
87
  case 'uc':
88
  if ($this->antibot_form_check()) {
89
- $user = NewsletterSubscription::instance()->unsubscribe();
90
  if ($user->status == 'E') {
91
- NewsletterSubscription::instance()->show_message('unsubscription_error', $user);
92
  } else {
93
- NewsletterSubscription::instance()->show_message('unsubscribed', $user);
94
  }
95
  return;
96
  } else {
@@ -100,29 +100,37 @@ class NewsletterSubscription extends NewsletterModule {
100
  break;
101
  case 'p':
102
  case 'pe':
103
- $user = NewsletterSubscription::instance()->check_user();
104
  if ($user == null) {
105
  die('No subscriber found.');
106
  }
107
 
108
- NewsletterSubscription::instance()->show_message('profile', $user);
109
  die();
110
  break;
 
 
 
 
 
 
 
 
111
  case 'c':
112
  if ($this->antibot_form_check()) {
113
- $user = NewsletterSubscription::instance()->confirm();
114
  if ($user->status == 'E') {
115
- NewsletterSubscription::instance()->show_message('error', $user->id);
116
  } else {
117
  setcookie('newsletter', $user->id . '-' . $user->token, time() + 60 * 60 * 24 * 365, '/');
118
- NewsletterSubscription::instance()->show_message('confirmed', $user);
119
  }
120
  } else {
121
  $this->request_to_antibot_form('Confirm');
122
  }
123
  die();
124
  break;
125
-
126
  default:
127
  return;
128
  }
@@ -177,7 +185,7 @@ class NewsletterSubscription extends NewsletterModule {
177
  add_option('newsletter_subscription_template', $options_template, null, 'no');
178
  }
179
  $this->init_options('template', false);
180
-
181
  if (isset($this->options['template'])) {
182
  unset($this->options['template']);
183
  unset($this->options['template_enabled']);
@@ -220,7 +228,6 @@ class NewsletterSubscription extends NewsletterModule {
220
  //
221
  // return $content;
222
  // }
223
-
224
  // function shortcode_newsletter_lock($attrs, $content = null) {
225
  // global $hyper_cache_stop, $cache_stop;
226
  //
@@ -1457,25 +1464,22 @@ class NewsletterSubscription extends NewsletterModule {
1457
  $options = get_option('newsletter_profile');
1458
 
1459
  $buffer .= '<div class="newsletter newsletter-profile">';
1460
- $buffer .= '<form action="' . plugins_url('newsletter/do/save.php') . '" method="post">';
1461
  // TODO: use nk
1462
- $buffer .= '<input type="hidden" name="nk" value="' . $user->id . '-' . $user->token . '"/>';
1463
  $buffer .= '<table cellspacing="0" cellpadding="3" border="0">';
1464
- $buffer .= '<tr><th align="right">' . $options['email'] . '</th><td><input class="newsletter-email" type="text" size="30" name="ne" value="' . htmlspecialchars($user->email) . '"/></td></tr>';
1465
  if ($options['name_status'] >= 1) {
1466
- $buffer .= '<tr><th align="right">' . $options['name'] . '</th><td><input class="newsletter-firstname" type="text" size="30" name="nn" value="' . htmlspecialchars($user->name) . '"/></td></tr>';
1467
  }
1468
  if ($options['surname_status'] >= 1) {
1469
- $buffer .= '<tr><th align="right">' . $options['surname'] . '</th><td><input class="newsletter-lastname" type="text" size="30" name="ns" value="' . htmlspecialchars($user->surname) . '"/></td></tr>';
1470
  }
1471
  if ($options['sex_status'] >= 1) {
1472
- $buffer .= '<tr><th align="right">' . $options['sex'] . '</th><td><select name="nx" class="newsletter-sex">';
1473
- // if (!empty($options['sex_none'])) {
1474
- // $buffer .= '<option value="n"' . ($user->sex == 'n' ? ' selected' : '') . '>' . $options['sex_none'] . '</option>';
1475
- // }
1476
- $buffer .= '<option value="f"' . ($user->sex == 'f' ? ' selected' : '') . '>' . $options['sex_female'] . '</option>';
1477
- $buffer .= '<option value="m"' . ($user->sex == 'm' ? ' selected' : '') . '>' . $options['sex_male'] . '</option>';
1478
- $buffer .= '<option value="n"' . ($user->sex == 'n' ? ' selected' : '') . '>' . $options['sex_none'] . '</option>';
1479
  $buffer .= '</select></td></tr>';
1480
  }
1481
 
@@ -1484,12 +1488,12 @@ class NewsletterSubscription extends NewsletterModule {
1484
  if ($options['profile_' . $i . '_status'] == 0)
1485
  continue;
1486
 
1487
- $buffer .= '<tr><th align="right">' . $options['profile_' . $i] . '</th><td>';
1488
- //if ($options['list_type_' . $i] != 'public') continue;
1489
  $field = 'profile_' . $i;
1490
 
1491
  if ($options['profile_' . $i . '_type'] == 'text') {
1492
- $buffer .= '<input class="newsletter-profile newsletter-profile-' . $i . '" type="text" size="50" name="np' . $i . '" value="' . htmlspecialchars($user->$field) . '"/>';
1493
  }
1494
 
1495
  if ($options['profile_' . $i . '_type'] == 'select') {
@@ -1500,7 +1504,7 @@ class NewsletterSubscription extends NewsletterModule {
1500
  $buffer .= '<option';
1501
  if ($opts[$j] == $user->$field)
1502
  $buffer .= ' selected';
1503
- $buffer .= '>' . $opts[$j] . '</option>';
1504
  }
1505
  $buffer .= '</select>';
1506
  }
@@ -1519,7 +1523,7 @@ class NewsletterSubscription extends NewsletterModule {
1519
  if ($user->$list == 1) {
1520
  $buffer .= ' checked';
1521
  }
1522
- $buffer .= '/>&nbsp;<span class="newsletter-preference-label">' . htmlspecialchars($options['list_' . $i]) . '</span><br />';
1523
  }
1524
  $buffer .= '</div></td></tr>';
1525
 
@@ -1532,9 +1536,9 @@ class NewsletterSubscription extends NewsletterModule {
1532
  $buffer .= '<tr><td colspan="2" class="newsletter-td-submit">';
1533
 
1534
  if (strpos($options['save'], 'http://') !== false) {
1535
- $buffer .= '<input class="newsletter-submit" type="image" src="' . $options['save'] . '"/></td></tr>';
1536
  } else {
1537
- $buffer .= '<input class="newsletter-submit" type="submit" value="' . $options['save'] . '"/></td></tr>';
1538
  }
1539
 
1540
  $buffer .= '</table></form></div>';
@@ -1595,13 +1599,13 @@ class NewsletterSubscription extends NewsletterModule {
1595
  "gender: " . $user->sex . "\n";
1596
 
1597
  $options_profile = get_option('newsletter_profile');
1598
-
1599
  for ($i = 0; $i < NEWSLETTER_LIST_MAX; $i++) {
1600
  if (empty($options_profile['list_' . $i])) {
1601
  continue;
1602
  }
1603
  $field = 'list_' . $i;
1604
- $message .= $options_profile['list_' . $i] . ': ' . (empty($user->$field)?"NO":"YES") . "\n";
1605
  }
1606
 
1607
  for ($i = 0; $i < NEWSLETTER_PROFILE_MAX; $i++) {
@@ -1612,7 +1616,7 @@ class NewsletterSubscription extends NewsletterModule {
1612
  $message .= $options_profile['profile_' . $i] . ': ' . $user->$field . "\n";
1613
  }
1614
 
1615
-
1616
 
1617
  $message .= "token: " . $user->token . "\n" .
1618
  "status: " . $user->status . "\n";
@@ -1621,7 +1625,7 @@ class NewsletterSubscription extends NewsletterModule {
1621
  $email = get_option('admin_email');
1622
  }
1623
  $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
1624
- Newsletter::instance()->mail($email, '[' . $blogname . '] ' . $subject, array('text'=>$message));
1625
  }
1626
 
1627
  }
@@ -1761,7 +1765,6 @@ function newsletter_shortcode($attrs, $content) {
1761
  // // Now we associate it with wp
1762
  // $module->set_user_wp_user_id($user->id, $wp_user_id);
1763
  //}
1764
-
1765
  // Compatibility code
1766
 
1767
  function newsletter_form($number = null) {
1
  <?php
2
+
3
+ if (!defined('ABSPATH'))
4
+ exit;
5
 
6
  require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
7
 
27
  parent::__construct('subscription', '2.0.2');
28
 
29
  // $this->options_lock = $this->get_options('lock');
 
30
  //add_action('wp_login', array($this, 'hook_wp_login'));
 
31
  // Must be called after the Newsletter::hook_init, since some constants are defined
32
  // there.
33
  add_action('init', array($this, 'hook_init'), 90);
57
  switch ($newsletter->action) {
58
  case 's':
59
 
60
+ if (isset($this->options['antibot_disable']) || $this->antibot_form_check()) {
61
 
62
+ $user = $this->subscribe();
63
 
64
  if ($user->status == 'E')
65
+ $this->show_message('error', $user->id);
66
  if ($user->status == 'C')
67
+ $this->show_message('confirmed', $user->id);
68
  if ($user->status == 'A')
69
+ $this->show_message('already_confirmed', $user->id);
70
  if ($user->status == 'S')
71
+ $this->show_message('confirmation', $user->id);
72
  } else {
73
 
74
+ $this->request_to_antibot_form('Subscribe');
75
  }
76
  die();
77
  case 'u':
78
+ $user = $this->get_user_from_request();
79
  $email = $this->get_email_from_request();
80
  if ($user == null) {
81
+ $this->show_message('unsubscription_error', null);
82
  } else {
83
+ $this->show_message('unsubscription', $user, null, $email);
84
  }
85
  die();
86
  break;
87
  case 'uc':
88
  if ($this->antibot_form_check()) {
89
+ $user = $this->unsubscribe();
90
  if ($user->status == 'E') {
91
+ $this->show_message('unsubscription_error', $user);
92
  } else {
93
+ $this->show_message('unsubscribed', $user);
94
  }
95
  return;
96
  } else {
100
  break;
101
  case 'p':
102
  case 'pe':
103
+ $user = $this->check_user();
104
  if ($user == null) {
105
  die('No subscriber found.');
106
  }
107
 
108
+ $this->show_message('profile', $user);
109
  die();
110
  break;
111
+
112
+ case 'ps':
113
+ $user = $this->save_profile();
114
+ // $user->alert is a temporary field
115
+ $this->show_message('profile', $user, $user->alert);
116
+ die();
117
+ break;
118
+
119
  case 'c':
120
  if ($this->antibot_form_check()) {
121
+ $user = $this->confirm();
122
  if ($user->status == 'E') {
123
+ $this->show_message('error', $user->id);
124
  } else {
125
  setcookie('newsletter', $user->id . '-' . $user->token, time() + 60 * 60 * 24 * 365, '/');
126
+ $this->show_message('confirmed', $user);
127
  }
128
  } else {
129
  $this->request_to_antibot_form('Confirm');
130
  }
131
  die();
132
  break;
133
+
134
  default:
135
  return;
136
  }
185
  add_option('newsletter_subscription_template', $options_template, null, 'no');
186
  }
187
  $this->init_options('template', false);
188
+
189
  if (isset($this->options['template'])) {
190
  unset($this->options['template']);
191
  unset($this->options['template_enabled']);
228
  //
229
  // return $content;
230
  // }
 
231
  // function shortcode_newsletter_lock($attrs, $content = null) {
232
  // global $hyper_cache_stop, $cache_stop;
233
  //
1464
  $options = get_option('newsletter_profile');
1465
 
1466
  $buffer .= '<div class="newsletter newsletter-profile">';
1467
+ $buffer .= '<form action="' . esc_attr(home_url('/') . '?na=ps') . '" method="post">';
1468
  // TODO: use nk
1469
+ $buffer .= '<input type="hidden" name="nk" value="' . esc_attr($user->id . '-' . $user->token) . '">';
1470
  $buffer .= '<table cellspacing="0" cellpadding="3" border="0">';
1471
+ $buffer .= '<tr><th align="right">' . esc_html($options['email']) . '</th><td><input class="newsletter-email" type="text" size="30" name="ne" required value="' . esc_attr($user->email) . '"></td></tr>';
1472
  if ($options['name_status'] >= 1) {
1473
+ $buffer .= '<tr><th align="right">' . esc_html($options['name']) . '</th><td><input class="newsletter-firstname" type="text" size="30" name="nn" value="' . esc_attr($user->name) . '"></td></tr>';
1474
  }
1475
  if ($options['surname_status'] >= 1) {
1476
+ $buffer .= '<tr><th align="right">' . esc_html($options['surname']) . '</th><td><input class="newsletter-lastname" type="text" size="30" name="ns" value="' . esc_attr($user->surname) . '"></td></tr>';
1477
  }
1478
  if ($options['sex_status'] >= 1) {
1479
+ $buffer .= '<tr><th align="right">' . esc_html($options['sex']) . '</th><td><select name="nx" class="newsletter-sex">';
1480
+ $buffer .= '<option value="f"' . ($user->sex == 'f' ? ' selected' : '') . '>' . esc_html($options['sex_female']) . '</option>';
1481
+ $buffer .= '<option value="m"' . ($user->sex == 'm' ? ' selected' : '') . '>' . esc_html($options['sex_male']) . '</option>';
1482
+ $buffer .= '<option value="n"' . ($user->sex == 'n' ? ' selected' : '') . '>' . esc_html($options['sex_none']) . '</option>';
 
 
 
1483
  $buffer .= '</select></td></tr>';
1484
  }
1485
 
1488
  if ($options['profile_' . $i . '_status'] == 0)
1489
  continue;
1490
 
1491
+ $buffer .= '<tr><th align="right">' . esc_html($options['profile_' . $i]) . '</th><td>';
1492
+
1493
  $field = 'profile_' . $i;
1494
 
1495
  if ($options['profile_' . $i . '_type'] == 'text') {
1496
+ $buffer .= '<input class="newsletter-profile newsletter-profile-' . $i . '" type="text" size="50" name="np' . $i . '" value="' . esc_attr($user->$field) . '"/>';
1497
  }
1498
 
1499
  if ($options['profile_' . $i . '_type'] == 'select') {
1504
  $buffer .= '<option';
1505
  if ($opts[$j] == $user->$field)
1506
  $buffer .= ' selected';
1507
+ $buffer .= '>' . esc_html($opts[$j]) . '</option>';
1508
  }
1509
  $buffer .= '</select>';
1510
  }
1523
  if ($user->$list == 1) {
1524
  $buffer .= ' checked';
1525
  }
1526
+ $buffer .= '/>&nbsp;<span class="newsletter-preference-label">' . esc_html($options['list_' . $i]) . '</span><br />';
1527
  }
1528
  $buffer .= '</div></td></tr>';
1529
 
1536
  $buffer .= '<tr><td colspan="2" class="newsletter-td-submit">';
1537
 
1538
  if (strpos($options['save'], 'http://') !== false) {
1539
+ $buffer .= '<input class="newsletter-submit" type="image" src="' . esc_attr($options['save']) . '"></td></tr>';
1540
  } else {
1541
+ $buffer .= '<input class="newsletter-submit" type="submit" value="' . esc_attr($options['save']) . '"/></td></tr>';
1542
  }
1543
 
1544
  $buffer .= '</table></form></div>';
1599
  "gender: " . $user->sex . "\n";
1600
 
1601
  $options_profile = get_option('newsletter_profile');
1602
+
1603
  for ($i = 0; $i < NEWSLETTER_LIST_MAX; $i++) {
1604
  if (empty($options_profile['list_' . $i])) {
1605
  continue;
1606
  }
1607
  $field = 'list_' . $i;
1608
+ $message .= $options_profile['list_' . $i] . ': ' . (empty($user->$field) ? "NO" : "YES") . "\n";
1609
  }
1610
 
1611
  for ($i = 0; $i < NEWSLETTER_PROFILE_MAX; $i++) {
1616
  $message .= $options_profile['profile_' . $i] . ': ' . $user->$field . "\n";
1617
  }
1618
 
1619
+
1620
 
1621
  $message .= "token: " . $user->token . "\n" .
1622
  "status: " . $user->status . "\n";
1625
  $email = get_option('admin_email');
1626
  }
1627
  $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
1628
+ Newsletter::instance()->mail($email, '[' . $blogname . '] ' . $subject, array('text' => $message));
1629
  }
1630
 
1631
  }
1765
  // // Now we associate it with wp
1766
  // $module->set_user_wp_user_id($user->id, $wp_user_id);
1767
  //}
 
1768
  // Compatibility code
1769
 
1770
  function newsletter_form($number = null) {