WP Subscribe - Version 1.0.2

Version Description

  • Added double opt-in possibility for Mailchimp
Download this release

Release Info

Developer MyThemeShop
Plugin Icon 128x128 WP Subscribe
Version 1.0.2
Comparing to
See all releases

Code changes from version 1.0.1 to 1.0.2

Files changed (3) hide show
  1. Mailchimp.php +1 -1
  2. readme.txt +5 -2
  3. wp-subscribe.php +11 -3
Mailchimp.php CHANGED
@@ -155,7 +155,7 @@ class Mailchimp {
155
 
156
  $this->ch = curl_init();
157
 
158
- if ($opts['CURLOPT_FOLLOWLOCATION'] === true) {
159
  curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);
160
  }
161
 
155
 
156
  $this->ch = curl_init();
157
 
158
+ if ( isset($opts['CURLOPT_FOLLOWLOCATION']) && $opts['CURLOPT_FOLLOWLOCATION'] === true) {
159
  curl_setopt($this->ch, CURLOPT_FOLLOWLOCATION, true);
160
  }
161
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mythemeshop
3
  Creator's website link: http://mythemeshop.com/plugins/wp-subscribe/
4
  Tags: subscribe, subscription, subscription box, newsletter, subscribe widget, mailchimp, aweber, feedburner,
5
  Requires at least: 3.0.1
6
- Tested up to: 4.0
7
- Stable tag: 1.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -72,6 +72,9 @@ Please disable all plugins and check if plugin is working properly. Then you can
72
 
73
  == Changelog ==
74
 
 
 
 
75
  = 1.0.1 =
76
  * Fixed Title field saving issue in newly added widget
77
  * Fixed compatibility with other plugins using Mailchimp API
3
  Creator's website link: http://mythemeshop.com/plugins/wp-subscribe/
4
  Tags: subscribe, subscription, subscription box, newsletter, subscribe widget, mailchimp, aweber, feedburner,
5
  Requires at least: 3.0.1
6
+ Tested up to: 4.2
7
+ Stable tag: 1.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
72
 
73
  == Changelog ==
74
 
75
+ = 1.0.2 =
76
+ * Added double opt-in possibility for Mailchimp
77
+
78
  = 1.0.1 =
79
  * Fixed Title field saving issue in newly added widget
80
  * Fixed compatibility with other plugins using Mailchimp API
wp-subscribe.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Subscribe
4
  Plugin URI: http://mythemeshop.com/plugins/wp-subscribe/
5
  Description: WP Subscribe is a simple but powerful subscription plugin which supports MailChimp, Aweber and Feedburner.
6
  Author: MyThemeShop
7
- Version: 1.0.1
8
  Author URI: http://mythemeshop.com/
9
  */
10
 
@@ -164,7 +164,7 @@ class wp_subscribe extends WP_Widget {
164
 
165
  function form( $instance ) {
166
  $defaults = $this->get_defaults();
167
- $instance = wp_parse_args( (array) $instance, $defaults );
168
  ?>
169
  <div class="wp_subscribe_options_form">
170
 
@@ -182,6 +182,11 @@ class wp_subscribe extends WP_Widget {
182
  <a href="http://kb.mailchimp.com/accounts/management/about-api-keys#Finding-or-generating-your-API-key" target="_blank"><?php _e('Find your API key', 'wp-subscribe'); ?></a>
183
  <?php $this->output_text_field('mailchimp_list_id', __('Mailchimp List ID', 'wp-subscribe'), $instance['mailchimp_list_id']); ?>
184
  <a href="http://kb.mailchimp.com/lists/managing-subscribers/find-your-list-id" target="_blank"><?php _e('Find your list ID', 'wp-subscribe'); ?></a>
 
 
 
 
 
185
  </div><!-- .wp_subscribe_account_details_mailchimp -->
186
 
187
  <div class="wp_subscribe_account_details_aweber" style="display: none;">
@@ -273,6 +278,7 @@ class wp_subscribe extends WP_Widget {
273
  'feedburner_id' => '',
274
  'mailchimp_api_key' => '',
275
  'mailchimp_list_id' => '',
 
276
  'aweber_list_id' => '',
277
 
278
  'title' => __('Get more stuff like this<br/> <span>in your inbox</span>', 'wp-subscribe'),
@@ -311,6 +317,7 @@ class wp_subscribe extends WP_Widget {
311
 
312
  $email = isset($_POST['mailchimp_email']) ? trim($_POST['mailchimp_email']) : '';
313
  $nonce = isset($_POST['_wpnonce']) ? trim($_POST['_wpnonce']) : '';
 
314
  $mc_api_key = null;
315
  $mc_list_id = null;
316
  $error_message = '';
@@ -320,6 +327,7 @@ class wp_subscribe extends WP_Widget {
320
  $mc_api_key = isset($widget_settings['mailchimp_api_key']) ? $widget_settings['mailchimp_api_key'] : null;
321
  $mc_list_id = isset($widget_settings['mailchimp_list_id']) ? $widget_settings['mailchimp_list_id'] : null;
322
  $error_message = isset($widget_settings['error_message']) ? $widget_settings['error_message'] : '';
 
323
  }
324
 
325
  if ($email &&
@@ -330,7 +338,7 @@ class wp_subscribe extends WP_Widget {
330
 
331
  try {
332
  $list = new Mailchimp_Lists(new Mailchimp($mc_api_key));
333
- $resp = $list->subscribe($mc_list_id, array('email' => $email), null, 'html', false, true);
334
 
335
  if ($resp) {
336
  $ret['success'] = true;
4
  Plugin URI: http://mythemeshop.com/plugins/wp-subscribe/
5
  Description: WP Subscribe is a simple but powerful subscription plugin which supports MailChimp, Aweber and Feedburner.
6
  Author: MyThemeShop
7
+ Version: 1.0.2
8
  Author URI: http://mythemeshop.com/
9
  */
10
 
164
 
165
  function form( $instance ) {
166
  $defaults = $this->get_defaults();
167
+ $instance = wp_parse_args( (array) $instance, $defaults );
168
  ?>
169
  <div class="wp_subscribe_options_form">
170
 
182
  <a href="http://kb.mailchimp.com/accounts/management/about-api-keys#Finding-or-generating-your-API-key" target="_blank"><?php _e('Find your API key', 'wp-subscribe'); ?></a>
183
  <?php $this->output_text_field('mailchimp_list_id', __('Mailchimp List ID', 'wp-subscribe'), $instance['mailchimp_list_id']); ?>
184
  <a href="http://kb.mailchimp.com/lists/managing-subscribers/find-your-list-id" target="_blank"><?php _e('Find your list ID', 'wp-subscribe'); ?></a>
185
+ <p class="wp_subscribe_mailchimp_double_optin"><label for="<?php echo $this->get_field_id('mailchimp_double_optin'); ?>">
186
+ <input type="hidden" name="<?php echo $this->get_field_name('mailchimp_double_optin'); ?>" value="0">
187
+ <input id="<?php echo $this->get_field_id('mailchimp_double_optin'); ?>" type="checkbox" name="<?php echo $this->get_field_name('mailchimp_double_optin'); ?>" value="1" <?php checked($instance['mailchimp_double_optin']); ?>>
188
+ <?php _e( 'Send double opt-in notification', 'wp-subscribe' ); ?>
189
+ </label></p>
190
  </div><!-- .wp_subscribe_account_details_mailchimp -->
191
 
192
  <div class="wp_subscribe_account_details_aweber" style="display: none;">
278
  'feedburner_id' => '',
279
  'mailchimp_api_key' => '',
280
  'mailchimp_list_id' => '',
281
+ 'mailchimp_double_optin' => 0,
282
  'aweber_list_id' => '',
283
 
284
  'title' => __('Get more stuff like this<br/> <span>in your inbox</span>', 'wp-subscribe'),
317
 
318
  $email = isset($_POST['mailchimp_email']) ? trim($_POST['mailchimp_email']) : '';
319
  $nonce = isset($_POST['_wpnonce']) ? trim($_POST['_wpnonce']) : '';
320
+
321
  $mc_api_key = null;
322
  $mc_list_id = null;
323
  $error_message = '';
327
  $mc_api_key = isset($widget_settings['mailchimp_api_key']) ? $widget_settings['mailchimp_api_key'] : null;
328
  $mc_list_id = isset($widget_settings['mailchimp_list_id']) ? $widget_settings['mailchimp_list_id'] : null;
329
  $error_message = isset($widget_settings['error_message']) ? $widget_settings['error_message'] : '';
330
+ $double_optin = !empty($widget_settings['mailchimp_double_optin']) ? true : false;
331
  }
332
 
333
  if ($email &&
338
 
339
  try {
340
  $list = new Mailchimp_Lists(new Mailchimp($mc_api_key));
341
+ $resp = $list->subscribe($mc_list_id, array('email' => $email), null, 'html', (bool) $double_optin, true);
342
 
343
  if ($resp) {
344
  $ret['success'] = true;