Multiple Forms in MailChimp

Home Forums Quform WordPress Multiple Forms in MailChimp

This topic is: resolved
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #23997
    thibautnorga
    Participant

    Hi guys,

    I’ve got 3 forms on my website. They need to go into 2 different lists in MailChimp.

    How do I do this?

    So form A and B need to go to MailChimp List 1, form C needs to go into MailChimp List 2.

    I’ve found some forum posts about the previous php coding, but I’m guessing it has evolved since the change of iphorm into quform.

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

    #24111
    thibautnorga
    Participant

    So,

    I used this, but the site keeps on crashin

    <?php
     
    /*
     * Plugin Name: Quform MailChimp Integration
     * Description: Add subscribers to MailChimp from Quform forms.
     * Version: 1.0
     */
     
    add_filter('quform_post_process_4', function (array $result, Quform_Form $form) {
        if (!class_exists('MCAPI')) {
            require_once dirname(__FILE__) . '/MCAPI.class.php';
        }
     
        $api = new MCAPI('xxx');
        $listId = 'xxx';
        $email = $form->getValue('quform_4_x');
        $mergeVars = array(
    		'FNAME' => $form->getValue('quform_4_x'),
    		'LNAME' => $form->getValue('quform_4_x'),
    		'GENDER' => $form->getValue('quform_4_x'),
    		'BDAY' => $form->getValue('quform_4_x'),
    		'COUNTRY' => $form->getValue('quform_4_x'),
    		'LINGO' => $form->getValue('quform_4_x')
    );
     
        // Other settings
        $emailType = 'html';
        $doubleOptin = false;
        $updateExisting = false;
        $replaceInterests = false;
        $sendWelcome = false;
     
        $api->listSubscribe($listId, $email, $mergeVars, $emailType, $doubleOptin, $updateExisting, $replaceInterests, $sendWelcome);
     
        return $result;
    }, 10, 2);
    
    add_filter('quform_post_process_2', function (array $result, Quform_Form $form) {
        if (!class_exists('MCAPI')) {
            require_once dirname(__FILE__) . '/MCAPI.class.php';
        }
     
        $api = new MCAPI('xxx');
        $listId = 'xxx';
        $email = $form->getValue('quform_2_x);
        $mergeVars = array(
    		'FNAME' => $form->getValue('quform_2_x'),
    		'LNAME' => $form->getValue('quform_2_x'),
    		'EMAIL' => $form->getValue('quform_2_x'),
    		'GENDER' => $form->getValue('quform_2_x'),
    		'BDAY' => $form->getValue('quform_2_x'),
    		'COUNTRY' => $form->getValue('quform_2_x'),
    		'LINGO' => $form->getValue('quform_2_x')
    );
    
     
        // Other settings
        $emailType = 'html';
        $doubleOptin = false;
        $updateExisting = false;
        $replaceInterests = false;
        $sendWelcome = false;
     
        $api->listSubscribe($listId, $email, $mergeVars, $emailType, $doubleOptin, $updateExisting, $replaceInterests, $sendWelcome);
     
        return $result;
    }, 10, 2);
    #24139
    thibautnorga
    Participant

    Solved, was missing a ‘

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