Easy Forms for MailChimp - Version 2.1.0

Version Description

  • Fix more jquery conflict issues
  • Clarification on how to add and manage list forms
Download this release

Release Info

Developer yikesinc
Plugin Icon 128x128 Easy Forms for MailChimp
Version 2.1.0
Comparing to
See all releases

Code changes from version 2.0.3 to 2.1.0

classes/class.yksemeBase.php CHANGED
@@ -533,9 +533,9 @@ public function processSnippet($list=false)
533
  public function addAdministrationMenu()
534
  {
535
  // Top Level Menu
536
- add_menu_page('Mailchimp Form', 'Mailchimp Form', 'manage_options', 'yks-mailchimp-form', array(&$this, 'generatePageOptions'), YKSEME_URL.'images/ykseme_16px.png', 400);
537
  // Sub Items
538
- add_submenu_page('yks-mailchimp-form', 'Manage Lists', 'Manage Lists', 'manage_options', 'yks-mailchimp-form-lists', array(&$this, 'generatePageLists'));
539
  add_submenu_page('yks-mailchimp-form', 'About YIKES, Inc.', 'About YIKES, Inc.', 'manage_options', 'yks-mailchimp-about-yikes', array(&$this, 'generatePageAboutYikes'));
540
  }
541
 
@@ -717,17 +717,18 @@ public function generateListContainers($listArr=false)
717
  public function getFrontendFormJavascript($list='')
718
  {
719
  if($list === '') return false;
 
720
  $js = false;
721
  foreach($list['fields'] as $field) : if($field['active'] == 1) :
722
  // Setup javascript
723
  if($field['require'] == '1') :
724
-
725
  $js .= "\n";
726
  switch($field['type'])
727
  {
728
  default:
729
  $js .= <<<JSC
730
- if($('#{$field[id]}').val() == '')
731
  {
732
  msg += '* {$field[label]}'+"\\n";
733
  err++;
@@ -736,22 +737,22 @@ JSC;
736
  break;
737
  case 'address':
738
  $js .= <<<JSC
739
- if($('#{$field[id]}').val() == '')
740
  {
741
  msg += '* {$field[label]}: Street Address'+"\\n";
742
  err++;
743
  }
744
- if($('#{$field[id]}-city').val() == '')
745
  {
746
  msg += '* {$field[label]}: City'+"\\n";
747
  err++;
748
  }
749
- if($('#{$field[id]}-state').val() == '')
750
  {
751
  msg += '* {$field[label]}: State'+"\\n";
752
  err++;
753
  }
754
- if($('#{$field[id]}-zip').val() == '')
755
  {
756
  msg += '* {$field[label]}: Zip Code'+"\\n";
757
  err++;
@@ -760,7 +761,7 @@ JSC;
760
  break;
761
  case 'radio':
762
  $js .= <<<JSC
763
- if($('.{$field[name]}:checked').length <= 0)
764
  {
765
  msg += '* {$field[label]}'+"\\n";
766
  err++;
@@ -1034,7 +1035,7 @@ private function runUpdateTasks_1_3_0()
1034
  $this->addList($list['list-id']);
1035
  }
1036
  }
1037
- $this->optionVal['version'] = '2.0.0';
1038
  return true;
1039
  }
1040
 
533
  public function addAdministrationMenu()
534
  {
535
  // Top Level Menu
536
+ add_menu_page('Mailchimp Forms', 'Mailchimp Forms', 'manage_options', 'yks-mailchimp-form', array(&$this, 'generatePageOptions'), YKSEME_URL.'images/ykseme_16px.png', 400);
537
  // Sub Items
538
+ add_submenu_page('yks-mailchimp-form', 'Manage List Forms', 'Manage List Forms', 'manage_options', 'yks-mailchimp-form-lists', array(&$this, 'generatePageLists'));
539
  add_submenu_page('yks-mailchimp-form', 'About YIKES, Inc.', 'About YIKES, Inc.', 'manage_options', 'yks-mailchimp-about-yikes', array(&$this, 'generatePageAboutYikes'));
540
  }
541
 
717
  public function getFrontendFormJavascript($list='')
718
  {
719
  if($list === '') return false;
720
+
721
  $js = false;
722
  foreach($list['fields'] as $field) : if($field['active'] == 1) :
723
  // Setup javascript
724
  if($field['require'] == '1') :
725
+ $prefix = "ymce";
726
  $js .= "\n";
727
  switch($field['type'])
728
  {
729
  default:
730
  $js .= <<<JSC
731
+ if($$prefix('#{$field[id]}').val() == '')
732
  {
733
  msg += '* {$field[label]}'+"\\n";
734
  err++;
737
  break;
738
  case 'address':
739
  $js .= <<<JSC
740
+ if($$prefix('#{$field[id]}').val() == '')
741
  {
742
  msg += '* {$field[label]}: Street Address'+"\\n";
743
  err++;
744
  }
745
+ if($$prefix('#{$field[id]}-city').val() == '')
746
  {
747
  msg += '* {$field[label]}: City'+"\\n";
748
  err++;
749
  }
750
+ if($$prefix('#{$field[id]}-state').val() == '')
751
  {
752
  msg += '* {$field[label]}: State'+"\\n";
753
  err++;
754
  }
755
+ if($$prefix('#{$field[id]}-zip').val() == '')
756
  {
757
  msg += '* {$field[label]}: Zip Code'+"\\n";
758
  err++;
761
  break;
762
  case 'radio':
763
  $js .= <<<JSC
764
+ if($$prefix('.{$field[name]}:checked').length <= 0)
765
  {
766
  msg += '* {$field[label]}'+"\\n";
767
  err++;
1035
  $this->addList($list['list-id']);
1036
  }
1037
  }
1038
+ $this->optionVal['version'] = '2.1.0';
1039
  return true;
1040
  }
1041
 
pages/lists.php CHANGED
@@ -5,7 +5,7 @@
5
  {
6
  if($('#yks-list-wrapper .yks-list-container').size() <= 0)
7
  {
8
- $('#yks-list-wrapper').html('<p>Looks like you don\'t have any lists setup -- why don\'t you try <a href="#" class="yks-mailchimp-list-add">adding one?</a></p>');
9
  }
10
  }
11
  function scrollToElement(e)
@@ -64,10 +64,7 @@
64
  noListsCheck();
65
  initializeScrollableLists();
66
  $('.yks-mailchimp-list-add').live('click', function(e){
67
- a = confirm("Are you sure you want to add a new list?");
68
- if(a)
69
- {
70
- lid = prompt("Please enter the list id.");
71
  if(lid !== '')
72
  {
73
  $.ajax({
@@ -93,12 +90,12 @@
93
  }
94
  else
95
  {
96
- alert("Looks like this list already exists!");
97
  }
98
  }
99
  });
100
  }
101
- }
102
  return false;
103
  });
104
  $('.yks-mailchimp-list-update').live('click', function(e){
@@ -220,11 +217,12 @@
220
 
221
  <h2 id="ykseme-page-header">
222
  Easy Mailchimp Extender
223
- <a href="#" class="button add-new-h2 yks-mailchimp-list-add">Add New List</a>
224
  <a href="#" class="button add-new-h2 yks-notice-toggle">Show Notice for Version 1 Users</a>
225
  </h2>
 
226
 
227
- <h3>Manage the Mailchimp Lists</h3>
228
 
229
  <div class="yks-status" style="display: block;">
230
  <div class="yks-hidden<?php echo ($_COOKIE['yks-mailchimp-notice-hidden'] == '1' ? ' yks-notice' : ''); ?>">
5
  {
6
  if($('#yks-list-wrapper .yks-list-container').size() <= 0)
7
  {
8
+ $('#yks-list-wrapper').html('<p>In order to setup a form for your mailing list you will first need to retrieve the list ID code from the Mailchimp list you wish to use.</p><p><a href="http://kb.mailchimp.com/article/how-can-i-find-my-list-id/" target="_blank">Click here for instructions on retrieving your "MailChimp list ID"</a></p><p>After retrieving your list ID <a href="#" class="yks-mailchimp-list-add">click here to get started.</a></p>');
9
  }
10
  }
11
  function scrollToElement(e)
64
  noListsCheck();
65
  initializeScrollableLists();
66
  $('.yks-mailchimp-list-add').live('click', function(e){
67
+ lid = prompt("Please enter your MailChimp list ID code.");
 
 
 
68
  if(lid !== '')
69
  {
70
  $.ajax({
90
  }
91
  else
92
  {
93
+ alert('Oops.. The list ID you entered appears to be incorrect. If you need help retrieving your list ID click on the "How to find your MailChimp list ID" link located on this page');
94
  }
95
  }
96
  });
97
  }
98
+
99
  return false;
100
  });
101
  $('.yks-mailchimp-list-update').live('click', function(e){
217
 
218
  <h2 id="ykseme-page-header">
219
  Easy Mailchimp Extender
220
+ <a href="#" class="button add-new-h2 yks-mailchimp-list-add">Add New list form by MailChimp "list ID"</a>
221
  <a href="#" class="button add-new-h2 yks-notice-toggle">Show Notice for Version 1 Users</a>
222
  </h2>
223
+ <p><a href="http://kb.mailchimp.com/article/how-can-i-find-my-list-id/" target="_blank">How to find your MailChimp list ID</a></p>
224
 
225
+ <h3>Manage the Mailchimp List Forms</h3>
226
 
227
  <div class="yks-status" style="display: block;">
228
  <div class="yks-hidden<?php echo ($_COOKIE['yks-mailchimp-notice-hidden'] == '1' ? ' yks-notice' : ''); ?>">
readme.md CHANGED
@@ -57,6 +57,10 @@ Due to the code overhaul required for the features of the new version, the struc
57
 
58
  Changes
59
  ===========
 
 
 
 
60
  ### 2.0.3:
61
  * Add labels to table option for form
62
 
57
 
58
  Changes
59
  ===========
60
+ ### 2.1.0
61
+ * Fix more jquery conflict issues
62
+ * Clarification on how to add and manage list forms
63
+
64
  ### 2.0.3:
65
  * Add labels to table option for form
66
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.yikesinc.com
4
  Tags: mailchimp, marketing, email, mailing lists, newsletter, signup
5
  Requires at least: 3.0
6
  Tested up to: 3.3
7
- Stable tag: 2.0.3
8
 
9
  The YIKES, Inc. Easy MailChimp extender gives you the ability to create sign up forms that allow site visitors to join your MailChimp lists.
10
 
@@ -72,6 +72,10 @@ Due to the code overhaul required for the features of the new version, the struc
72
  4. Sample list setup screen on MailChimp
73
 
74
  == Changelog ==
 
 
 
 
75
  = 2.0.3 =
76
  * Add labels to table option for form
77
 
4
  Tags: mailchimp, marketing, email, mailing lists, newsletter, signup
5
  Requires at least: 3.0
6
  Tested up to: 3.3
7
+ Stable tag: 2.1.0
8
 
9
  The YIKES, Inc. Easy MailChimp extender gives you the ability to create sign up forms that allow site visitors to join your MailChimp lists.
10
 
72
  4. Sample list setup screen on MailChimp
73
 
74
  == Changelog ==
75
+ = 2.1.0 =
76
+ * Fix more jquery conflict issues
77
+ * Clarification on how to add and manage list forms
78
+
79
  = 2.0.3 =
80
  * Add labels to table option for form
81
 
templates/shortcode_form.php CHANGED
@@ -1,9 +1,6 @@
1
-
2
- <script type='text/javascript' src='<?php echo YKSEME_URL; ?>js/jquery.1.7.1.min.js'></script>
3
  <script type="text/javascript">
4
- $.noConflict(true);
5
- jQuery.noConflict(true);
6
- jQuery(document).ready(function($){
7
  function blankFieldCheck()
8
  {
9
  err = 0;
@@ -11,54 +8,54 @@ jQuery.noConflict(true);
11
  <?php echo $this->getFrontendFormJavascript($list); ?>
12
  if(msg != '')
13
  {
14
- msg = 'Please fix the following fields before submitting the form:'+"\n\n"+msg;
15
  alert(msg);
16
  }
17
  return (err > 0 ? false : true);
18
  }
19
- $('#yks-mailchimp-form_<?php echo $list['id']; ?>').submit(function(e){
20
  e.preventDefault();
21
  // Make sure the api key exists
22
  if(blankFieldCheck())
23
  {
24
- $('#ykfmc-submit_<?php echo $list['id']; ?>').attr('disabled', 'disabled');
25
- $('#yks-status-<?php echo $list['id']; ?>').slideUp('fast');
26
- $.ajax({
27
  type: 'POST',
28
  url: '<?php echo YKSEME_URL_WP_AJAX; ?>',
29
  data: {
30
  action: 'yks_mailchimp_form',
31
  form_action: 'frontend_submit_form',
32
- form_data: $(this).serialize()
33
  },
34
  dataType: 'json',
35
  success: function(MAILCHIMP)
36
  {
37
  if(MAILCHIMP == '1')
38
  {
39
- $('#yks-status-<?php echo $list['id']; ?>').html('<div class="yks-success"><p>Thank You for subscribing! Check your email for the confirmation message.</p></div>');
40
- $('#yks-mailchimpFormContainerInner_<?php echo $list['id']; ?>').slideUp('fast', function(){
41
- $('#yks-status-<?php echo $list['id']; ?>').slideDown('fast');
42
  });
43
  }
44
  else
45
  {
46
- $('#ykfmc-submit_<?php echo $list['id']; ?>').removeAttr('disabled');
47
- $('#yks-status-<?php echo $list['id']; ?>').html('<div class="yks-error"><p>There was an error submiting the form -- please try again!</p></div>');
48
- $('#yks-status-<?php echo $list['id']; ?>').slideDown('fast');
49
  }
50
  }
51
  });
52
  }
53
  return false;
54
  });
55
- $('.yks-field-type-date').datepicker({
56
  changeMonth: true,
57
  changeYear: true,
58
  yearRange: ((new Date).getFullYear()-100)+':'+((new Date).getFullYear()),
59
  dateFormat: 'yy-mm-dd'
60
  });
61
- $('#ui-datepicker-div').addClass('yks-mailchimpFormDatepickerContainer');
62
  });
63
  </script>
64
 
 
 
1
  <script type="text/javascript">
2
+ $ymce = jQuery.noConflict();
3
+ jQuery(document).ready(function($ymce){
 
4
  function blankFieldCheck()
5
  {
6
  err = 0;
8
  <?php echo $this->getFrontendFormJavascript($list); ?>
9
  if(msg != '')
10
  {
11
+ msg = 'Oops.. Don\'t forget the fill-in the following fields:'+"\n\n"+msg;
12
  alert(msg);
13
  }
14
  return (err > 0 ? false : true);
15
  }
16
+ $ymce('#yks-mailchimp-form_<?php echo $list['id']; ?>').submit(function(e){
17
  e.preventDefault();
18
  // Make sure the api key exists
19
  if(blankFieldCheck())
20
  {
21
+ $ymce('#ykfmc-submit_<?php echo $list['id']; ?>').attr('disabled', 'disabled');
22
+ $ymce('#yks-status-<?php echo $list['id']; ?>').slideUp('fast');
23
+ $ymce.ajax({
24
  type: 'POST',
25
  url: '<?php echo YKSEME_URL_WP_AJAX; ?>',
26
  data: {
27
  action: 'yks_mailchimp_form',
28
  form_action: 'frontend_submit_form',
29
+ form_data: $ymce(this).serialize()
30
  },
31
  dataType: 'json',
32
  success: function(MAILCHIMP)
33
  {
34
  if(MAILCHIMP == '1')
35
  {
36
+ $ymce('#yks-status-<?php echo $list['id']; ?>').html('<div class="yks-success"><p>Thank You for subscribing! Check your email for the confirmation message.</p></div>');
37
+ $ymce('#yks-mailchimpFormContainerInner_<?php echo $list['id']; ?>').slideUp('fast', function(){
38
+ $ymce('#yks-status-<?php echo $list['id']; ?>').slideDown('fast');
39
  });
40
  }
41
  else
42
  {
43
+ $ymce('#ykfmc-submit_<?php echo $list['id']; ?>').removeAttr('disabled');
44
+ $ymce('#yks-status-<?php echo $list['id']; ?>').html('<div class="yks-error"><p>Sorry the email address you entered was previously submitted.</p></div>');
45
+ $ymce('#yks-status-<?php echo $list['id']; ?>').slideDown('fast');
46
  }
47
  }
48
  });
49
  }
50
  return false;
51
  });
52
+ $ymce('.yks-field-type-date').datepicker({
53
  changeMonth: true,
54
  changeYear: true,
55
  yearRange: ((new Date).getFullYear()-100)+':'+((new Date).getFullYear()),
56
  dateFormat: 'yy-mm-dd'
57
  });
58
+ $ymce('#ui-datepicker-div').addClass('yks-mailchimpFormDatepickerContainer');
59
  });
60
  </script>
61
 
yikes-inc-easy-mailchimp-extender.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: YIKES, Inc Easy Mailchimp Extender
5
  Plugin URI: http://www.yikesinc.com
6
  Description: Mailchimp API integration in the form of a shortcode or php snippet
7
- Version: 2.0.3
8
  Author: Yikes, Inc, Sean Kennedy, Tracy Levesque, Carlos Zuniga
9
  Author URI: http://www.yikesinc.com
10
  License: GPL2
@@ -29,7 +29,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
29
  #_________________________________________________ CONSTANTS
30
  /** Configuration **/
31
  if(!defined('YKSEME_DEBUG')) define('YKSEME_DEBUG', true);
32
- if(!defined('YKSEME_VERSION_CURRENT')) define('YKSEME_VERSION_CURRENT', '2.0.3');
33
  if(!defined('YKSEME_REQ_PHP')) define('YKSEME_REQ_PHP', '5.0');
34
  if(!defined('YKSEME_AUTHOR')) define('YKSEME_AUTHOR', 'Yikes, Inc, Sean Kennedy, Tracy Levesque, Carlos Zuniga');
35
  if(!defined('YKSEME_SITE')) define('YKSEME_SITE', site_url().'/');
@@ -61,33 +61,11 @@ register_activation_hook(__FILE__, array(&$yksemeBase, 'activate'));
61
  register_deactivation_hook(__FILE__, array(&$yksemeBase, 'deactivate'));
62
  register_uninstall_hook(__FILE__, array(&$yksemeBase, 'uninstall'));
63
 
64
- //Check for jquery
65
- $checkJQuery = true;
66
-
67
- if(!function_exists('get_option'))
68
- require_once('../../../wp-config.php');
69
-
70
 
71
  // Output jquery
72
  add_action('wp_head','yikes_mailch_jquery_js');
73
 
74
-
75
  function yikes_mailch_jquery_js() {?>
76
  <script type="ext/javascript" src="<?php echo YKSEME_URL; ?>js/prototype.js"></script>
77
- <script type="text/javascript">
78
- jQueryScriptOutputted = <?php echo ($checkJQuery===false?"true":"false");?>;
79
- function initJQuery() {
80
- if (typeof($) == 'undefined') {
81
-
82
-
83
- if (! jQueryScriptOutputted) {
84
- jQueryScriptOutputted = true;
85
- document.write("<scr" + "ipt type='text/javascript' src='<?php echo YKSEME_URL; ?>js/jquery.1.7.1.min.js'></scr" + "ipt>");
86
- }
87
- setTimeout("initJQuery()", 50);
88
- }
89
- }
90
- initJQuery();
91
- </script>
92
 
93
  <?php } ?>
4
  Plugin Name: YIKES, Inc Easy Mailchimp Extender
5
  Plugin URI: http://www.yikesinc.com
6
  Description: Mailchimp API integration in the form of a shortcode or php snippet
7
+ Version: 2.1.0
8
  Author: Yikes, Inc, Sean Kennedy, Tracy Levesque, Carlos Zuniga
9
  Author URI: http://www.yikesinc.com
10
  License: GPL2
29
  #_________________________________________________ CONSTANTS
30
  /** Configuration **/
31
  if(!defined('YKSEME_DEBUG')) define('YKSEME_DEBUG', true);
32
+ if(!defined('YKSEME_VERSION_CURRENT')) define('YKSEME_VERSION_CURRENT', '2.1.0');
33
  if(!defined('YKSEME_REQ_PHP')) define('YKSEME_REQ_PHP', '5.0');
34
  if(!defined('YKSEME_AUTHOR')) define('YKSEME_AUTHOR', 'Yikes, Inc, Sean Kennedy, Tracy Levesque, Carlos Zuniga');
35
  if(!defined('YKSEME_SITE')) define('YKSEME_SITE', site_url().'/');
61
  register_deactivation_hook(__FILE__, array(&$yksemeBase, 'deactivate'));
62
  register_uninstall_hook(__FILE__, array(&$yksemeBase, 'uninstall'));
63
 
 
 
 
 
 
 
64
 
65
  // Output jquery
66
  add_action('wp_head','yikes_mailch_jquery_js');
67
 
 
68
  function yikes_mailch_jquery_js() {?>
69
  <script type="ext/javascript" src="<?php echo YKSEME_URL; ?>js/prototype.js"></script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
  <?php } ?>