Adding MailChimp subscribers from Quform w/ Groups

Home Forums Quform WordPress Adding MailChimp subscribers from Quform w/ Groups

This topic is: resolved
Viewing 15 posts - 1 through 15 (of 21 total)
  • Author
    Posts
  • #20934
    clearscope
    Participant

    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

    #20947
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #20959
    clearscope
    Participant

    Hello,

    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.
    #20967
    clearscope
    Participant

    Hello,

    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.
    #20985
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #20989
    clearscope
    Participant

    Hello,

    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!

    #21002
    clearscope
    Participant

    Hello,

    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?

    #21011
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #21021
    clearscope
    Participant

    Hello,

    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?

    #21024
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #21028
    clearscope
    Participant

    Ok thank you!

    #21054
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #21108
    clearscope
    Participant

    Hello,

    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);
    #21122
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #21141
    clearscope
    Participant

    We have now sent along the requested info, thank you!

Viewing 15 posts - 1 through 15 (of 21 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy