Skip to content
Browse files

Adding correct checkbox hidden fields, splitting phone with a - to be…

… processed correctly on mailchimps end
  • Loading branch information...
1 parent 45151aa commit ba9d57c43408fae9de61045d6ecd1af588d88177 @kidfiction kidfiction committed Mar 2, 2012
Showing with 9 additions and 5 deletions.
  1. +7 −5 mailchimp.php
  2. +2 −0 mailchimp_widget.php
View
12 mailchimp.php
@@ -1172,8 +1172,11 @@ function mailchimpSF_signup_submit() {
$opt_val = isset($_POST[$opt]) ? $_POST[$opt] : '';
- if (is_array($opt_val)) {
- $opt_val = implode('', $opt_val);
+ if (is_array($opt_val) && isset($opt_val['area'])) {
+ $opt_val = implode('-', $opt_val);
+ }
+ else if (is_array($opt_val)) {
+ $opt_val = implode($opt_val);
}
if ($var['req'] == 'Y' && trim($opt_val) == '') {
@@ -1196,7 +1199,7 @@ function mailchimpSF_signup_submit() {
// Ensure we have an array
$igs = !is_array($igs) ? array() : $igs;
-
+ $groups = '';
foreach ($igs as $ig) {
if (get_option('mc_show_interest_groups_'.$ig['id']) == 'on') {
$groupings = array();
@@ -1240,7 +1243,6 @@ function mailchimpSF_signup_submit() {
// If we're good
if ($success) {
// Clear out empty merge vars
-
foreach ($merge as $k => $v) {
if (is_array($v) && empty($v)) {
unset($merge[$k]);
@@ -1268,7 +1270,7 @@ function mailchimpSF_signup_submit() {
if ($merge_key !== 'GROUPINGS') {
switch ($mv_tag_keys[$merge_key]['field_type']) {
case 'phone':
- $phone = implode($merge_value, '');
+ $phone = $merge_value;
if (!empty($phone)) {
if (preg_match('/[^0-9]/', $phone)) {
$errs[] = sprintf(__("%s must consist of only numbers", 'mailchimp_i18n'), esc_html($mv_tag_keys[$merge_key]['name']));
View
2 mailchimp_widget.php
@@ -233,11 +233,13 @@ function mailchimp_interest_group_field($ig) {
</select>';
break;
case 'hidden':
+ $i = 1;
foreach($ig['groups'] as $interest) {
$interest = $interest['name'];
$html .= '
<input type="checkbox" name="'.esc_attr($set_name.'['.$i.']').'" id="'.esc_attr('mc_interest_'.$ig['id'].'_'.$interest).'" class="mc_interest" value="'.esc_attr($interest).'" />
<label for="'. esc_attr('mc_interest_'.$ig['id'].'_'.$interest).'" class="mc_interest_label">'.esc_html($interest).'</label>';
+ $i++;
}
break;
}

0 comments on commit ba9d57c

Please sign in to comment.
Something went wrong with that request. Please try again.