MailChimp List Subscribe Form - Version 0.3

Version Description

Download this release

Release Info

Developer mc_jesse
Plugin Icon wp plugin MailChimp List Subscribe Form
Version 0.3
Comparing to
See all releases

Code changes from version 0.2 to 0.3

Files changed (2) hide show
  1. mailchimp.php +27 -10
  2. readme.txt +4 -4
mailchimp.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: MailChimp
4
  Plugin URI: http://mailchimp.com/api/plugins/wordpress
5
  Description: The MailChimp plugin allows you to easily setup a Subscribe box for your MailChimp list - So easy a chimp could do it!
6
- Version: 0.2
7
  Author: MailChimp API Support Team
8
  Author URI: http://mailchimp.com/api/
9
  */
@@ -216,7 +216,10 @@ if (isset($_REQUEST['change_form_settings'])){
216
  } else {
217
  update_option('mc_show_interest_groups','off');
218
  }
219
- $mv = unserialize(get_option('mc_merge_vars'));
 
 
 
220
  foreach($mv as $var){
221
  $opt = 'mc_mv_'.$var['tag'];
222
  if (isset($_REQUEST[$opt]) || $var['req']=='Y'){
@@ -315,9 +318,17 @@ else {
315
  }
316
  //Just get out if nothing else matters...
317
  if (get_option('mc_list_id') == '') return;
318
-
319
- $mv = unserialize(get_option('mc_merge_vars'));
320
- $ig = unserialize(get_option('mc_interest_groups'));
 
 
 
 
 
 
 
 
321
  ?>
322
  <form method="post" action="options-general.php?page=mc_setup_page">
323
  <?php wp_nonce_field('update-options'); ?>
@@ -396,8 +407,8 @@ if (sizeof($mv)==0){
396
  echo '</table>';
397
  }
398
  echo '<h4>Interest Groups</h4>';
399
- if ($ig=='' || $ig=='N'){
400
- echo "<i>No Interest Groups Setup</i>";
401
  } else {
402
  ?>
403
  <table class='widefat'>
@@ -442,8 +453,14 @@ function mc_register_widgets(){
442
 
443
  }
444
  function mc_display_widget(){
445
- $mv = unserialize(get_option('mc_merge_vars'));
446
- $ig = unserialize(get_option('mc_interest_groups'));
 
 
 
 
 
 
447
  $msg = '';
448
  if (isset($_REQUEST['mc_signup'])){
449
  $failed = false;
@@ -505,7 +522,7 @@ function mc_display_widget(){
505
  foreach($mv as $var){
506
  $opt = 'mc_mv_'.$var['tag'];
507
  if ($var['req'] || get_option($opt)=='on'){
508
- echo ''.$var['name'].':<br/><input type="text" size="20" value="" name="'.$opt.'">';
509
  if ($var['req']){ echo '*'; }
510
  echo '<br/>';
511
  }
3
  Plugin Name: MailChimp
4
  Plugin URI: http://mailchimp.com/api/plugins/wordpress
5
  Description: The MailChimp plugin allows you to easily setup a Subscribe box for your MailChimp list - So easy a chimp could do it!
6
+ Version: 0.3
7
  Author: MailChimp API Support Team
8
  Author URI: http://mailchimp.com/api/
9
  */
216
  } else {
217
  update_option('mc_show_interest_groups','off');
218
  }
219
+ $mv = get_option('mc_merge_vars');
220
+ if (!is_array($mv)){
221
+ $mv = unserialize(get_option('mc_merge_vars'));
222
+ }
223
  foreach($mv as $var){
224
  $opt = 'mc_mv_'.$var['tag'];
225
  if (isset($_REQUEST[$opt]) || $var['req']=='Y'){
318
  }
319
  //Just get out if nothing else matters...
320
  if (get_option('mc_list_id') == '') return;
321
+ $mv = get_option('mc_merge_vars');
322
+ $ig = get_option('mc_interest_groups');
323
+ if (!is_array($mv)){
324
+ //apparently in WP 2.6 get_option() unserializes arrays for us.
325
+ $mv = unserialize($mv);
326
+ $ig = unserialize($ig);
327
+ }
328
+ if (!is_array($ig)){
329
+ //means we got false returned
330
+ $ig = unserialize($ig);
331
+ }
332
  ?>
333
  <form method="post" action="options-general.php?page=mc_setup_page">
334
  <?php wp_nonce_field('update-options'); ?>
407
  echo '</table>';
408
  }
409
  echo '<h4>Interest Groups</h4>';
410
+ if (!$ig || $ig=='' || $ig=='N'){
411
+ echo "<i>No Interest Groups Setup for this List</i>";
412
  } else {
413
  ?>
414
  <table class='widefat'>
453
 
454
  }
455
  function mc_display_widget(){
456
+ $mv = get_option('mc_merge_vars');
457
+ $ig = get_option('mc_interest_groups');
458
+ if (!is_array($mv)){
459
+ //apparently in WP 2.6 get_option() unserializes arrays for us.
460
+ $mv = unserialize($mv);
461
+ $ig = unserialize($ig);
462
+ }
463
+
464
  $msg = '';
465
  if (isset($_REQUEST['mc_signup'])){
466
  $failed = false;
522
  foreach($mv as $var){
523
  $opt = 'mc_mv_'.$var['tag'];
524
  if ($var['req'] || get_option($opt)=='on'){
525
+ echo ''.$var['name'].':<br/><input type="text" size="18" value="" name="'.$opt.'">';
526
  if ($var['req']){ echo '*'; }
527
  echo '<br/>';
528
  }
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: mc_jesse
3
  Tags: mailchimp, email, newsletter, signup, marketing, plugin, widget
4
  Requires at least: 2.3
5
- Tested up to: 2.5.1
6
- Stable tag: 0.2
7
  Author URI: http://www.mailchimp.com/api/
8
  Plugin URI: http://www.mailchimp.com/plugins/wordpress.phtml
9
 
@@ -22,7 +22,7 @@ selecting options for the Merge Fields and Interest Groups you have setup, and t
22
  time from starting installation to have the form on your site should be less than 5 minutes - absolutely everything
23
  can be done via the Wordpress Setting GUI - no file editing at all!
24
 
25
- You can also visit our [homepage for the plugin](http://www.mailchimp.com/plugins/wordpress.phtml), but if you are reading this,
26
  you probably don't need to.
27
 
28
  == Installation ==
@@ -40,7 +40,7 @@ This section describes how to install the plugin and get started using it.
40
  1. Finally, go to Presentation->Widgets and enable the `MailChimp` widget
41
  1. And you are DONE!
42
 
43
- = Version 2.5 =
44
  1. Unzip our archive and upload the entire `mailchimp` directory to your `/wp-content/plugins/` directory
45
  1. Activate the plugin through the 'Plugins' menu in WordPress
46
  1. Go to Settings and look for "MailChimp Setup" in the menu
2
  Contributors: mc_jesse
3
  Tags: mailchimp, email, newsletter, signup, marketing, plugin, widget
4
  Requires at least: 2.3
5
+ Tested up to: 2.6
6
+ Stable tag: 0.3
7
  Author URI: http://www.mailchimp.com/api/
8
  Plugin URI: http://www.mailchimp.com/plugins/wordpress.phtml
9
 
22
  time from starting installation to have the form on your site should be less than 5 minutes - absolutely everything
23
  can be done via the Wordpress Setting GUI - no file editing at all!
24
 
25
+ You can also visit our [homepage for the plugin](http://www.mailchimp.com/api/wordpress.phtml), but if you are reading this,
26
  you probably don't need to.
27
 
28
  == Installation ==
40
  1. Finally, go to Presentation->Widgets and enable the `MailChimp` widget
41
  1. And you are DONE!
42
 
43
+ = Version 2.5+ =
44
  1. Unzip our archive and upload the entire `mailchimp` directory to your `/wp-content/plugins/` directory
45
  1. Activate the plugin through the 'Plugins' menu in WordPress
46
  1. Go to Settings and look for "MailChimp Setup" in the menu