MailChimp Integration – Opt-In Subscribe

Home Forums Quform WordPress MailChimp Integration – Opt-In Subscribe

This topic is: resolved
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #13735
    danieltjohnston
    Participant

    I have a contact form that I want to add an opt-in checkbox to that will allow the person to join our mailchimp newsletter. Is there a way to integrate MailChimp with this form, so that if the user checks the box to join the newsletter, they are added to our MailChimp list, but if they don’t check the box, they are not added.

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

    #13756
    danieltjohnston
    Participant

    Thanks for your help. If I wanted to apply this function to multiple forms, all connected to the same mailchimp list, how would I do that?

    Thanks again.

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

    #14554
    danieltjohnston
    Participant

    Hi Ally,
    I finally got a chance to test it out, but it doesn’t seem to be working. No matter if I check the box or not, no email address is pushed through to Mailchimp.

    Here’s the code that I’m using, minus my API and list ID…


    function my_save_to_mailchimp_location_opt_in($form)
    {
    if (!in_array('Join our Newsletter - Sign Up for Additional Resources and Cost Savings Ideas', $form->getValue('iphorm_1_9'))) {
    return; }

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

    $api = new MCAPI('1111111111111111111'); $listId = '11111111111'; $email = $form->getValue('iphorm_1_5');
    // 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_3_2'), 'MERGE2' => $form->getValue('iphorm_3_3'), 'MERGE3' => $form->getValue('iphorm_1_5') );
    */
    // Other settings
    $emailType = 'html';
    $doubleOptin = true;
    $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);

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

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

    #14652
    danieltjohnston
    Participant

    Hi Ally,
    I enabled the debug mode logging.

    Here’s a copy of the log:
    http://www.johnstoncompanies.com/debug.log

    and the page with the form:
    http://www.johnstoncompanies.com/locations/joplin/

    Thanks.

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

    #14703
    danieltjohnston
    Participant

    Hi Ally,
    I temporarily disabled the sending emails on the Form Builder. Here’s the updated log:

    http://www.johnstoncompanies.com/debug.log

    I attempted the test @ 15:44 of 3/18.

    #14704
    danieltjohnston
    Participant

    Hi Ally,
    I figured it out, I had failed to update the

    add_action('iphorm_post_process_1', 'my_save_to_mailchimp', 10, 1);

    to point to the new function name. Once I changed it to this it worked fine.

    add_action('iphorm_post_process_1', 'my_save_to_mailchimp_location_opt_in', 10, 1);

    Thanks for your help.

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

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