Home › Forums › Quform WordPress › Several Quforms to the same Mailchimp List
This topic is: resolved
- This topic has 2 replies, 2 voices, and was last updated 8 years, 3 months ago by fulmin.
Viewing 3 posts - 1 through 3 (of 3 total)
- AuthorPosts
- January 27, 2016 at 3:32 pm #18053fulminParticipant
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.
January 28, 2016 at 12:39 pm #18060AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
January 28, 2016 at 2:27 pm #18061fulminParticipantOk !!! Thanks a lot Ally !
- AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.