MailChimp functions.php

Home Forums Quform WordPress MailChimp functions.php

This topic is: not resolved

This topic contains 1 reply, has 2 voices, and was last updated by  Ally 6 years, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3527

    horsemaidsissi
    Participant

    Hi,

    I have been working on linking my form with Mailchimp. I got through all your instructions fine, and added the code into functions.php. When I load my site I now see all the code I just added at the very top of the page.

    What am I doing wrong? PS. I included the last few lines of code just in case I missed something. I’ve been imputing from add_action.


    ?php endforeach; ?>
    <?php
    // Reset the global $the_post as this query will have stomped on it
    wp_reset_postdata();
    endif;
    ?>
    <input type="hidden" id="<?php echo $widgetId; ?>_offset" name="<?php echo $widgetId; ?>_offset" value="<?php echo $offset; ?>"/>
    <?php
    }
    ?>

    add_action('iphorm_post_process_1', 'mytheme_save_to_mailchimp', 10, 1);
    function mytheme_save_to_mailchimp($form)
    {
    require_once dirname(__FILE__) . '/MCAPI.class.php';

    $api = new MCAPI('myactualapikey'); $listId = 'myactuallistid'; $email = $form->getValue('iphorm_1_3');
    // OPTIONAL: if you are saving additional fields to MC, set the merge tags, otherwise set $mergeVars to an empty array
    $mergeVars = array(
    'EMAIL' => $form->getValue('iphorm_1_3'),
    'FNAME' => $form->getValue('iphorm_1_1'),
    'LNAME' => $form->getValue('iphorm_1_6'),
    'COMPANY' => $form->getValue('iphorm_1_2'),
    'WSITE' => $form->getValue('iphorm_1_20'),
    'PHONE' => $form->getValue('iphorm_1_30'),
    'JOBDESC' => $form->getValue('iphorm_1_19'),
    'ADDRESS' => $form->getValue('iphorm_1_9'),
    'ADDRESSD' => $form->getValue('iphorm_1_15'),
    'CITY' => $form->getValue('iphorm_1_16'),
    'PCODE' => $form->getValue('iphorm_1_12'),
    'PROVINCE' => $form->getValue('iphorm_1_11'),
    'URGENCY' => $form->getValue('iphorm_1_24')

    );

    // Other settings
    $emailType = 'html';
    $doubleOptin = false;
    $updateExisting = false;
    $replaceInterests = false;
    $sendWelcome = false;

    $api->listSubscribe($listId, $email, $mergeVars, $emailType, $doubleOptin, $updateExisting, $replaceInterests, $sendWelcome);
    }

    Thanks for your help!
    Chelsey

    #3534

    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 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Be inspired. © 2019 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy