Forum Replies Created

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • in reply to: How to create more than one form subscribing to Mailchimp? #4955
    atomedia
    Participant

    I have no idea why, but it doesn’t work. Please look at the code of the second function below (I’ve replaced API key and list ID with XXX).


    add_action('iphorm_post_process_2', 'mytheme_save_to_mailchimp2', 10, 1);

    function mytheme_save_to_mailchimp2($form)
    {
    require_once dirname(__FILE__) . '/MCAPI.class.php';

    $api = new MCAPI('XXX');
    $listId = 'XXX';
    $email = $form->getValue('iphorm_2_3');

    // 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_2_1'),
    'MERGE2' => $form->getValue('iphorm_2_2'),
    'GROUPINGS' => array(
    array('name' => 'Jaką firmę reprezentujesz?', 'groups' => join(',', $form->getValue('iphorm_2_12'))),
    array('name' => 'Jaki asortyment Cię interesuje?', 'groups' => join(',', $form->getValue('iphorm_2_6'))),
    array('name' => 'Który biuletyn chcesz dostawać?', 'groups' => 'Wiadomości z branży zabawek i art. dziecięcych (co tydzień)')
    )
    );

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

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

    in reply to: Add emails to MailChimp List Groups #4911
    atomedia
    Participant

    It works, you’re great! Thanks a lot! 🙂

    in reply to: Add emails to MailChimp List Groups #4864
    atomedia
    Participant

    Sorry Ally, my mistake! The fields are not Multiple Choice, they are both Checkboxes!

    I have changed one of them to Multiple Choice and then everything works.

    Unfortunately, I need Checkboxes, so the problem still exists.

    Regards
    Marek

    in reply to: Add emails to MailChimp List Groups #4863
    atomedia
    Participant

    I’ve double checked and the names of the groups are exactly the same as in Mailchimp. I’ve replaced $form->getValue(‘iphorm_1_4′) with one of the options (‘Sklep stacjonarny’) and then it works.

    Best
    Marek

    in reply to: Add emails to MailChimp List Groups #4836
    atomedia
    Participant

    $mergeVars = array(
    'MERGE1' => $form->getValue('iphorm_1_1'),
    'MERGE2' => $form->getValue('iphorm_1_2'),
    'GROUPINGS' => array(
    array('name' => 'Jaka firme reprezentujesz?', 'groups' => $form->getValue('iphorm_1_4')),
    array('name' => 'Jaki asortyment Cie interesuje?', 'groups' => $form->getValue('iphorm_1_6')),
    array('name' => 'Ktory biuletyn chcesz dostawac?', 'groups' => 'Darmowe raporty i e-booki (nieregularnie)')
    )
    );

    The 3rd grouping (Ktory biuletyn chcesz dostawac) works fine, but the previous two – don’t.
    Both iphorm_1_4 and iphorm_1_6 are Multiple Choice fields.
    I hope you’ll be able help me 🙂

    Best regards
    Marek

    in reply to: Add emails to MailChimp List Groups #4821
    atomedia
    Participant

    Now it’s clear for me, thank you! Everything works except choosing the groups. The subscriber is added to Mailchimp, but with no groups selected. Maybe I should change other settings?


    $emailType = 'html';
    $doubleOptin = false;
    $updateExisting = false;
    $replaceInterests = false;
    $sendWelcome = false;

    Best
    Marek

    in reply to: Add emails to MailChimp List Groups #4804
    atomedia
    Participant

    Hi Ally,

    Could you please explain – what do you mean saying “name of the group” and “list of groups”? Actual names (descriptive), names from the source code or IDs? Where to find these parameters?

    What if I want to let the subscribers choose the groups by themselves using multiple choice field?

    Best regards,
    Marek

Viewing 7 posts - 1 through 7 (of 7 total)
Be inspired. © 2025 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy