Multiple Quforms link to the same Mailchimp List

Home Forums Quform WordPress Multiple Quforms link to the same Mailchimp List

This topic is: resolved
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #9393
    rsn8
    Participant

    Is this possible?

    Thanks…Jay

    #9396
    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.

    #9418
    rsn8
    Participant

    Hi Ally :::…

    I think I understand. But just in case – can you please check my work.
    The form IDs :: 1 & 2

    Email fields ::
    Form 1 – iphorm_1_3
    Form 2 – iphorm_2_3

    the additional fields I’m gathering for Mailchimp ::
    Form 1 – First Name (iphorm_1_1) & Last Name (iphorm_1_9)
    Form 2 – First Name (iphorm_2_1) & Last Name (iphorm_2_9)

    My code ::

    // Mailchimp additions

    function my_save_to_mailchimp($form)
    {
    if (!class_exists('MCAPI')) {
    require_once dirname(__FILE__) . '/MCAPI.class.php';
    }

    $api = new MCAPI('APIKEY');
    $listId = 'LISTID';
    switch($form->getId()) {
    case 1:
    $email = $form->getValue('iphorm_1_3');
    break;
    case 2:
    $email = $form->getValue('iphorm_2_3');
    break;
    }
    // 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_1_1'),
    'MERGE2' => $form->getValue('iphorm_1_9'),
    );

    // 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_1', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_2', 'my_save_to_mailchimp', 10, 1);

    Thanks for your help…Jay

    • This reply was modified 11 years, 5 months ago by Ally. Reason: Removed API key
    #9424
    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.

    #9432
    rsn8
    Participant

    Thank you so much!

    #9435
    rsn8
    Participant

    Hi. we are now getting a parse error with the code :

    Parse error: syntax error, unexpected ‘&’ in /home1/arorie/public_html/hero-design.com/wp-content/themes/purity/functions.php on line 420

    This is the following line :: switch($form->getId()) {

    I’ve reverted to an earlier version of functions.php until this is working.

    any thoughts?

    thanks…j

    #9442
    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.

    #9447
    rsn8
    Participant

    awesome. let me test that out. much appreciated…j

    #18838
    dreanpinheiro
    Participant

    My case is like that, but I have much more forms on my site. With 1 form integration work, but to put all my code did not work.

    Any idea what might have occurred?

     
    
    /*-----------------------
    Mailchimp integration
    ------------------------*/
    
    function my_save_to_mailchimp($form)
    {
    if (!class_exists('MCAPI')) {
    require_once dirname(__FILE__) . '/MCAPI.class.php';
    }
     
    $api = new MCAPI('myAPI');
    $listId = 'myListID';
    switch($form->getId()) {
    case 1:
     $email = $form->getValue('iphorm_15_5');
     $fname = $form->getValue('iphorm_15_4');
     $state = $form->getValue('iphorm_15_49');
     break;
    
    case 2:
     $email = $form->getValue('iphorm_16_2');
     $fname = $form->getValue('iphorm_16_1');
     $state = $form->getValue('iphorm_16_6');
     break;
    
    case 3:
     $email = $form->getValue('iphorm_12_5');
     $fname = $form->getValue('iphorm_12_1');
     $state = $form->getValue('iphorm_12_109');
     break;
    
    case 4:
     $email = $form->getValue('iphorm_13_5');
     $fname = $form->getValue('iphorm_13_1');
     $state = $form->getValue('iphorm_13_109');
     break;
    
    case 5:
     $email = $form->getValue('iphorm_14_5');
     $fname = $form->getValue('iphorm_14_1');
     $state = $form->getValue('iphorm_14_109');
     break;
    
    case 6:
     $email = $form->getValue('iphorm_15_5');
     $fname = $form->getValue('iphorm_15_1');
     $state = $form->getValue('iphorm_15_109');
     break;
    
    case 7:
     $email = $form->getValue('iphorm_19_5');
     $fname = $form->getValue('iphorm_19_1');
     $state = $form->getValue('iphorm_19_109');
     break;
    
    case 8:
     $email = $form->getValue('iphorm_20_5');
     $fname = $form->getValue('iphorm_20_1');
     $state = $form->getValue('iphorm_20_109');
     break;
    
    case 9:
     $email = $form->getValue('iphorm_21_5');
     $fname = $form->getValue('iphorm_21_1');
     $state = $form->getValue('iphorm_21_109');
     break;
    
    case 10:
     $email = $form->getValue('iphorm_22_5');
     $fname = $form->getValue('iphorm_22_1');
     $state = $form->getValue('iphorm_22_109');
     break;
    
    case 11:
     $email = $form->getValue('iphorm_23_5');
     $fname = $form->getValue('iphorm_23_1');
     $state = $form->getValue('iphorm_23_109');
     break;
    
    case 12:
     $email = $form->getValue('iphorm_26_5');
     $fname = $form->getValue('iphorm_26_1');
     $state = $form->getValue('iphorm_26_109');
     break;
    
    case 13:
     $email = $form->getValue('iphorm_28_5');
     $fname = $form->getValue('iphorm_28_1');
     $state = $form->getValue('iphorm_28_109');
     break;
    
    case 14:
     $email = $form->getValue('iphorm_29_5');
     $fname = $form->getValue('iphorm_29_1');
     $state = $form->getValue('iphorm_29_109');
     break;
    
    case 15:
     $email = $form->getValue('iphorm_30_5');
     $fname = $form->getValue('iphorm_30_1');
     $state = $form->getValue('iphorm_30_109');
     break;
    
    case 16:
     $email = $form->getValue('iphorm_31_5');
     $fname = $form->getValue('iphorm_31_1');
     $state = $form->getValue('iphorm_31_109');
     break;
    
    case 17:
     $email = $form->getValue('iphorm_32_5');
     $fname = $form->getValue('iphorm_32_1');
     $state = $form->getValue('iphorm_32_109');
     break;
    
    case 18:
     $email = $form->getValue('iphorm_33_5');
     $fname = $form->getValue('iphorm_33_1');
     $state = $form->getValue('iphorm_33_109');
     break;
    
    case 19:
     $email = $form->getValue('iphorm_34_5');
     $fname = $form->getValue('iphorm_34_1');
     $state = $form->getValue('iphorm_34_109');
     break;
    
    case 20:
     $email = $form->getValue('iphorm_35_5');
     $fname = $form->getValue('iphorm_35_1');
     $state = $form->getValue('iphorm_35_109');
     break;
    
    case 21:
     $email = $form->getValue('iphorm_36_5');
     $fname = $form->getValue('iphorm_36_1');
     $state = $form->getValue('iphorm_36_109');
     break;
    
    case 22:
     $email = $form->getValue('iphorm_37_5');
     $fname = $form->getValue('iphorm_37_1');
     $state = $form->getValue('iphorm_37_109');
     break;
    
    case 23:
     $email = $form->getValue('iphorm_38_5');
     $fname = $form->getValue('iphorm_38_1');
     $state = $form->getValue('iphorm_38_109');
     break;
    
    case 24:
     $email = $form->getValue('iphorm_39_5');
     $fname = $form->getValue('iphorm_39_1');
     $state = $form->getValue('iphorm_39_109');
     break;
    
    case 25:
     $email = $form->getValue('iphorm_40_5');
     $fname = $form->getValue('iphorm_40_1');
     $state = $form->getValue('iphorm_40_109');
     break;
    
    case 26:
     $email = $form->getValue('iphorm_96_5');
     $fname = $form->getValue('iphorm_96_4');
     $state = $form->getValue('iphorm_96_51');
     break;
    
    case 27:
     $email = $form->getValue('iphorm_98_2');
     $fname = $form->getValue('iphorm_98_1');
     $state = $form->getValue('iphorm_98_22');
     break;
    
    case 28:
     $email = $form->getValue('iphorm_100_5');
     $fname = $form->getValue('iphorm_100_4');
     $state = $form->getValue('iphorm_100_50');
     break;
    
        }
    
     
        // OPTIONAL: if you are saving additional fields to MC, set the merge tags, otherwise set $mergeVars to an empty array
        $mergeVars = array(
            'FNAME' => $fname,
            'ESTADO' => $state,
        );
    
        // Other settings
        $emailType = 'html';
        $doubleOptin = true;
        $updateExisting = true;
        $replaceInterests = false;
        $sendWelcome = true;
     
        $api->listSubscribe($listId, $email, $mergeVars, $emailType, $doubleOptin, $updateExisting, $replaceInterests, $sendWelcome);
    }
    add_action('iphorm_post_process_15', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_16', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_12', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_13', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_14', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_15', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_19', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_20', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_21', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_22', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_23', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_26', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_28', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_29', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_30', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_31', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_32', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_33', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_34', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_35', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_36', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_37', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_38', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_39', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_40', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_96', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_98', 'my_save_to_mailchimp', 10, 1);
    add_action('iphorm_post_process_100', 'my_save_to_mailchimp', 10, 1);
    
     
    • This reply was modified 9 years, 4 months ago by dreanpinheiro.
    #18849
    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.

    • This reply was modified 9 years, 4 months ago by Ally.
Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2025 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy