When you try to submit a field other than the email address, MailChimp will not accept the value. I believe I have narrowed it down to this line of code, but I am starting to go cross-eyed looking at it. I would appreciate any help. I beleive the issue is with the format of the array.
Line 98 of webform_mailchimp.module
$mergefields_replacements[$mergefields_key_array[$field['form_key']]] = $submission->data[$key]['value'][0];
I have also manually created the array for $mergefields_replacements, and MailChimp will accept those values. The code that I used to test it, is below.
$mergefields_replacements = array('FNAME' => 'John');
Thanks,
TJ
Comments
Comment #1
tjferre commentedI have narrowed down the issue a little further.
I believe that $mergefields_key_array is not being set properly. The only value it contains is the email field. The $mergefields_key_array should only contain mailchimp fields excluding the email. The email is set already and should not be included in the $mergefields_key_array. The email is the first field of $field['extra']['mergefields'], subsequent mailchimp fields are not being not being included in $mergefields_key_array. I would appreciate any help in resolving this issue.
Line 61 of webform_mailchimp.module
Drupal 7.14
Comment #2
tjferre commentedI have narrowed it down a little further. The issue I found is that the mergefields are not being seperated correctly. I am still trying to narrow down how the field should be exploded but \n is not working.
$keyvaluepairs = explode("\n", $field['extra']['mergefields']);TJ
Comment #3
jpburn commentedComment #3.0
jpburn commentedChanged the wording
Comment #4
VanessaM commentedcan you explain how this can be fixed? I am having the same problem and am not a programmer.
thanks!
Comment #5
lionsharz commentedI'm still having this issue with the latest dev plus patches for the 4.x branch of MailChimp and the 4.x branch of Webform.
I can add subsribers from the Webform without any merge fields, interest fields, double opt-in but as soon as I add *any* of those merge fields to the box or interest groups or double opt-in the subscription fails.
I've changed the code as above with the patched dev version (https://www.drupal.org/node/1052290 committed to latest dev to work with 4.x branch) but no joy. No error messages are showing.
Any pointers?
Comment #6
knalstaaf commentedComment #7
knalstaaf commentedClearing the cache worked for me.
Reopen if deemed necessary.