latest stable versions: v150827 (changelog)

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Mailchimp Groups and Registration Form

Home Forums Community Forum Mailchimp Groups and Registration Form

This topic contains 1 reply, has 1 voice. Last updated by  Regis Cassidy 4 years, 6 months ago.

Topic Author Topic
Posted: Wednesday Jul 11th, 2012 at 11:49 am #18932

(UPDATE: Now Solved. Please see my response/solution in the next post)

Hello. I have a single Mailchimp list divided into groups based on a small set of user locations. Therefore, I’ve added the custom location field drop down menu on my registration form. All my S2members are Level 0 subscribers.

What do I need to do to grab this custom field on the registration form and pass it on to S2Member’s Mailchimp integration so that I can add them to the proper Mailchimp group.

FYI, I would like to take advantage of Mailchimp Groups and not just add a custom MERGE tag.

Thanks so much,
Regis

  • This topic was modified 4 years, 6 months ago by  Regis Cassidy.

List Of Topic Replies

Viewing 1 replies (of 1 total)
Author Replies
Author Replies
Posted: Thursday Jul 12th, 2012 at 2:26 pm #19059

I came up with a solution and thought I would share.

1. In my Mailchimp account I create the group name ‘Location’ under my single list
2. In S2Member->General Options->Registration/Profile Fields & Options I created a new field with the unique id ‘location’ and configured this as a drop down menu with the appropriate fields.
3. In S2Member->API/List Servers->MailChimp Integration I entered my single Mailchimp list ID number under free users
4. I SSHed to my webhost and created the file wp-content/mu-plugins/s2-hacks.php and entered the following code:

<?php
    add_filter("ws_plugin__s2member_mailchimp_merge_array", "my_filter", 10, 2);
    function my_filter($merge, $vars)
        {
            $user_id = $vars["user_id"];
            $user_custom = get_user_option("wp_s2member_custom_fields", $user_id);
            $mc_group_val = $user_custom['location'];   //use your unique field id from step 2 here
            $interest_group = array ("GROUPINGS" => array (array ("name" => 'Location', "groups" => $mc_group_val)));   //where name is the Group name created in MailChimp (e.g. Location)

            return array_merge($merge, $interest_group);
        }
?>

I hope this may help others as it took me quite some time to figure this out.

Good luck,
Regis

Viewing 1 replies (of 1 total)

This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.

Old Forums (READ-ONLY): The community now lives at WP Sharks™. If you have an s2Member® Pro question, please use our new Support System.

Contacting s2Member: Please use our Support Center for bug reports, pre-sale questions & technical assistance.