Several Quforms to the same Mailchimp List

Home Forums Quform WordPress Several Quforms to the same Mailchimp List

This topic is: resolved
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #18053
    fulmin
    Participant

    Hello !

    I try to make a code to link several Quforms to the same Mailchimp list. The code is working fine if I use 1 form, but it’s not sending any informations to Mailcimp if I try to add another form.

    Could you please have a look and tell me if you see something wrong ?

    
    
    function my_save_to_mailchimp($form)
    {
        if (!class_exists('MCAPI')) {
            require_once dirname(__FILE__) . '/MCAPI.class.php';
        }
     
        $api = new MCAPI('5dxxxxxxxxxxx');
        $listId = '8xxxxxxxx';
    	switch($form->getId()) {
    case 1:
    $email = $form->getValue('iphorm_24_2');
    $fname = $form->getValue('iphorm_24_1');
    break;
    case 2:
    $email = $form->getValue('iphorm_13_2');
    $fname = $form->getValue('iphorm_13_1');
    break;
    }
        // OPTIONAL: if you are saving additional fields to MC, set the merge tags, otherwise set $mergeVars to an empty array
        $mergeVars = array(
    'MERGE1' => $fname
           
        );
     
        // 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_24', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_13', 'my_save_to_mailchimp', 10, 1);
    
    

    Thanks a lot for your help !

    • This topic was modified 8 years, 3 months ago by Ally.
    #18060
    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.

    #18061
    fulmin
    Participant

    Ok !!! Thanks a lot Ally !

Viewing 3 posts - 1 through 3 (of 3 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