Home › Forums › Quform WordPress › Adding MailChimp subscribers from Quform w/ Groups
- This topic has 20 replies, 3 voices, and was last updated 5 years, 11 months ago by Harrison.
- AuthorPosts
- March 14, 2017 at 7:49 am #20934clearscopeParticipant
Hello,
We have set up the Quform / Mailchimp integration for our email signup form, per the instructions on this page: https://support.themecatcher.net/quform-wordpress/guides/integration/mailchimp
However, we cannot figure out how to add the correct code or merge tag to incorporate the Mailchimp groups for that list: http://kb.mailchimp.com/lists/groups/create-a-new-list-group
Can you please explain how we can map the field in the Quform form to the Mailchimp group list?
Thank you
March 14, 2017 at 10:25 pm #20947AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
March 16, 2017 at 6:40 am #20959clearscopeParticipantHello,
Thank you for the reply.
However we do not seem to be able to get the integration to work, even without the GROUPINGS mergeVars.
Even after testing multiple times, we cannot get any submission to actually appear in the Mailchimp account.
Here is the code that we have added to the functions.php file. Can you please tell us if there is something wrong with the code that is preventing it from working properly?
function my_save_to_mailchimp($form) { if (!class_exists('MCAPI')) { require_once dirname(__FILE__) . '/MCAPI.class.php'; } $api = new MCAPI('key'); $listId = 'listid'; $email = $form->getValue('iphorm_21_3'); // OPTIONAL: if you are saving additional fields to MC, set the merge tags, otherwise set $mergeVars to an empty array $mergeVars = array( 'MERGE1' => $form->getValue('iphorm_21_1'), 'MERGE2' => $form->getValue('iphorm_21_2'), 'MERGE3' => $form->getValue('iphorm_21_4'), 'MERGE4' => $form->getValue('iphorm_21_5'), 'MERGE6' => $form->getValue('iphorm_21_6'), 'MERGE17' => $form->getValue('iphorm_21_7') ); $mergeVars = array( 'GROUPINGS' => array( array( 'name' => "Email lists to join:", // You can use either 'name' or 'id' to identify the group 'groups' => array($form->getValue('iphorm_21_8')) ) ) ); // Other settings $emailType = 'html'; $doubleOptin = false; $updateExisting = false; $replaceInterests = false; $sendWelcome = false; $api->listSubscribe($listId, $email, $mergeVars, $emailType, $doubleOptin, $updateExisting, $replaceInterests, $sendWelcome); } add_action('iphorm_post_process_21', 'my_save_to_mailchimp', 10, 1);
- This reply was modified 7 years, 1 month ago by Ally. Reason: Removed API key
Attachments:
You must be logged in to view attached files.March 22, 2017 at 2:54 am #20967clearscopeParticipantHello,
We would very much like to get our Quform form working with Mailchimp, but non of our submissions appear in the Mailchimp account.
Can you please help us here to get this working? Is there something wrong with the code that we are using?
Thank you!
- This reply was modified 7 years, 1 month ago by clearscope.
March 24, 2017 at 10:00 pm #20985AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
March 26, 2017 at 7:11 am #20989clearscopeParticipantHello,
Thank you very much for the reply.
Actually upon checking the Mailchimp account it seems that our submission from March 16th did actually go through properly. So there seems to be some sort of delay with Mailchimp whereby data does not seem to be immediately added (which makes testing a bit cumbersome). But it does seem to be working, which is great.
The only thing that we have not been able to confirm is the GROUPINGS, which did not go through. However it’s possible that the recorded submission was made before the GROUPINGS code was added. We have performed an additional test now with that coded included and will follow up in Mailchimp.
We have also reset the API per your instructions.
Many thanks!
March 28, 2017 at 2:33 am #21002clearscopeParticipantHello,
We can now confirm that the submissions are going through to MailChimp with the original code (without GROUPINGS). However when the GROUPINGS code is included the submissions do not go through at all. So there seems to be an issue with the GROUPINGS code.
So to summarize, when we use the following code, the submissions DO work:
$mergeVars = array( 'MERGE1' => $form->getValue('iphorm_21_1'), 'MERGE2' => $form->getValue('iphorm_21_2'), 'MERGE3' => $form->getValue('iphorm_21_4'), 'MERGE4' => $form->getValue('iphorm_21_5'), 'MERGE6' => $form->getValue('iphorm_21_6'), 'MERGE17' => $form->getValue('iphorm_21_7') );
However, when we add the GROUPINGS code as follows, the submissions DO NOT work and nothing is entered into MailChimp at all (it basically breaks the form):
$mergeVars = array( 'MERGE1' => $form->getValue('iphorm_21_1'), 'MERGE2' => $form->getValue('iphorm_21_2'), 'MERGE3' => $form->getValue('iphorm_21_4'), 'MERGE4' => $form->getValue('iphorm_21_5'), 'MERGE6' => $form->getValue('iphorm_21_6'), 'MERGE17' => $form->getValue('iphorm_21_7') ); $mergeVars = array( 'GROUPINGS' => array( array( 'name' => "Email lists to join:", // You can use either 'name' or 'id' to identify the group 'groups' => array($form->getValue('iphorm_21_8')) ) ) );
Additionally, when we try instead adding the GROUPINGS code to the same $mergeVars as for the fields, the submissions DO work (so it does not break the form), but the GROUPINGS data is still not entered into Mailchimp:
$mergeVars = array( 'MERGE1' => $form->getValue('iphorm_21_1'), 'MERGE2' => $form->getValue('iphorm_21_2'), 'MERGE3' => $form->getValue('iphorm_21_4'), 'MERGE4' => $form->getValue('iphorm_21_5'), 'MERGE6' => $form->getValue('iphorm_21_6'), 'MERGE17' => $form->getValue('iphorm_21_7'), 'GROUPINGS' => array( array( 'name' => "Email lists to join:", // You can use either 'name' or 'id' to identify the group 'groups' => array($form->getValue('iphorm_21_8')) ) ) );
Could you please help us sort out how to get this working properly?
March 29, 2017 at 7:35 pm #21011AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
March 30, 2017 at 6:58 am #21021clearscopeParticipantHello,
We have tried now with the group ID but it still does not work. The values within the Quform field do match exactly. However, even when we try without using the Quform array for groups and enter the groups manually into the code, to test, the group info still does not come through. So it seems that something is missing or incorrect with the code to have the group info entered, because it doesn’t work even without the Quform field.
Perhaps it has something to do with the “For MailChimp API v3” notes at the top of the article? It seems that the code that you provided is for the v2.0 solution, so maybe this could be part of it?
We understand that this is outside of your scope of support. It is a bummer because we are so close to having this working, and we have already invested a lot of time into trying to get this integration working properly. But we do need to be able to have the groups, and we understand that you do not support this.
If it’s not possible for MailChimp groups to work with Quform, is there another form plugin that you could recommend that can?
March 30, 2017 at 9:12 am #21024AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
March 30, 2017 at 10:38 pm #21028clearscopeParticipantOk thank you!
April 6, 2017 at 9:45 am #21054AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
April 15, 2017 at 5:10 am #21108clearscopeParticipantHello,
Thank you, however when we try the above code for $mergeVars it just seems to break the form again and nothing gets sent through to Mailchimp (though no error gets logged if we enable DEBUG).
When we use the original code it works properly and the contact is created in Mailchimp, but this of course does not contain the Groups:
function my_save_to_mailchimp($form) { if (!class_exists('MCAPI')) { require_once dirname(__FILE__) . '/MCAPI.class.php'; } $api = new MCAPI('key'); $listId = 'listid'; $email = $form->getValue('iphorm_21_3'); // OPTIONAL: if you are saving additional fields to MC, set the merge tags, otherwise set $mergeVars to an empty array $mergeVars = array( 'MERGE1' => $form->getValue('iphorm_21_1'), 'MERGE2' => $form->getValue('iphorm_21_2'), 'MERGE3' => $form->getValue('iphorm_21_4'), 'MERGE4' => $form->getValue('iphorm_21_5'), 'MERGE6' => $form->getValue('iphorm_21_6'), 'MERGE17' => $form->getValue('iphorm_21_7') ); // Other settings $emailType = 'html'; $doubleOptin = false; $updateExisting = false; $replaceInterests = false; $sendWelcome = false; $api->listSubscribe($listId, $email, $mergeVars, $emailType, $doubleOptin, $updateExisting, $replaceInterests, $sendWelcome); } add_action('iphorm_post_process_21', 'my_save_to_mailchimp', 10, 1);
April 18, 2017 at 11:24 am #21122AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
April 19, 2017 at 5:48 am #21141clearscopeParticipantWe have now sent along the requested info, thank you!
- AuthorPosts
- You must be logged in to reply to this topic.