PriMoThemes — now s2Member® (official notice)

This is now a very OLD forum system. It's in READ-ONLY mode.
All community interaction now occurs at WP Sharks™. See: new forums @ WP Sharks™

Custom Variables and MailChimp

s2Member Plugin. A Membership plugin for WordPress®.

Custom Variables and MailChimp

Postby cassel » September 28th, 2011, 7:05 pm

Two questions here:
The first one should be simple (i think). I had initially set up two mailing list, one for Level0 and one for Level1. Now, i find that people who were on the Level0 list, purchase a product, end up also on Level1 list and it gets very confusing to manage for what i use the mailing list. Since there is an ID code for Level0 and one for Level1 in the MailChimp integration tab, can i change the ID code for the Level1 and put it the same as the Level0 so that everyone would end up on the same list?

Question two. This one might be tougher. As i could (hopefully) collect all the names in the one list, is there a way i could use my custom variables (cv1) to enter it as a specific field in MailChimp, so i would be able to easily segment my list when i want to send specific mailing. I am thinking of having a field only for the members who purchased a course, while that field would be empty for those who never purchased and simply opted in.

And then, depending on the answer to the second question, how could i do it with my existing list without having to start from scratch?
P.S. I initially asked the MailChimp support staff and they said to ask here.
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Custom Variables and MailChimp

Postby Cristián Lávaque » September 30th, 2011, 5:40 pm

1. There's a setting to remove users from one list when adding them to the next. WP Admin -> s2Member -> API / List Servers -> Automate -> Removals and Transitions

2. You can save ccaps as MailChimp merge fields. viewtopic.php?f=4&t=10148&p=20994#p20994

I don't know how you can add those to existing names in your list, thoug.

I hope that helps. :)
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Custom Variables and MailChimp

Postby cassel » September 30th, 2011, 6:53 pm

Thanks. I'll go study that. At least there is hope. And if i have to do it manually for the existing list, it is very annoying but feasible with some time.
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Custom Variables and MailChimp

Postby Cristián Lávaque » October 2nd, 2011, 2:03 am

Got it. I'll email Jason asking if there's a way to apply that to existing users.
Cristián Lávaque http://s2member.net
Is s2Member working for you? Please rate it Image at WordPress.org. Thanks! :)
User avatar
Cristián Lávaque
Developer
Developer
 
Posts: 6836
Joined: December 22, 2010

Re: Custom Variables and MailChimp

Postby Jason Caldwell » October 7th, 2011, 2:37 pm

Cristián Lávaque wrote:Got it. I'll email Jason asking if there's a way to apply that to existing users.

For existing Users/Members, there is a flag that can be set in s2Member's call to the MailChimp API, which forces MailChimp to update an existing User/Member instead of failing on a duplicate email address.

Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_filter
("ws_plugin__s2member_mailchimp_update_existing", "__return_true");
?>

Now go to your Dashboard, select a User and re-subscribe them to your list, using the checkbox provided by s2Member. If they are already on your list, MailChimp will see that they are ALREADY subscribed, so no confirmation would be sent, but the data associated with their Profile would be updated ( e.g. MERGE vars ). Of course, you could probably automate some of this further, but that would require some custom coding by a developer familiar with WordPress/s2Member. As long as you don't mind doing things manually though, this should work fine.

Once you have MERGE vars configured for each subscriber in MailChimp, which may include any bit of data about a User/Member if you wish ( see this article about configuring MERGE vars ), you can use the tools provided in your MailChimp account to narrow down segments you wish to mail, based on criteria that you use to narrow down a list of recipients.

SNAG-0015.png


Reference articles:
viewtopic.php?f=4&t=10148&p=20994#p20994
http://apidocs.mailchimp.com/api/1.3/li ... e.func.php
http://codex.wordpress.org/Function_Reference/get_users
viewtopic.php?f=40&t=12608&src_doc_v=111003#src_doc_process_list_servers%28%29
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA

Re: Custom Variables and MailChimp

Postby cassel » October 7th, 2011, 8:06 pm

Thanks. I will work on that this weekend, and update you later. :)
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Custom Variables and MailChimp

Postby cassel » October 16th, 2011, 5:47 pm

As i am looking at this, i am just a bit unsure of the sequence of the steps. What comes first? Do i have to set the MERGE var in MailChimp first and then create the hack file? I think i can follow those instructions, but just not sure of the order. Could you clarify that?

Also, re-re-reading the instructions for that hack file, you mention S2_CUSTOM. How do i get more than one custom var? If i have product A and product B and product C and a customer can get any one of them or any combination of 2 (or 3) even if not at the same time, how are they identified?

Another silly question: if i already created a hack file for another task, do i just add to the same file for this?

Then, maybe something for down the road, but if the user is not automatically updated (like if it is an existing user) in WP, will this variable STILL be updated in MailChimp? Meaning does the information go to MailChimp right at registration/payment or only when it comes back to s2Member? (meaning that if s2M does not update it, MailChimp wont either)
User avatar
cassel
Experienced User
Experienced User
 
Posts: 442
Joined: February 17, 2011

Re: Custom Variables and MailChimp

Postby Jason Caldwell » October 17th, 2011, 5:12 pm

As i am looking at this, i am just a bit unsure of the sequence of the steps. What comes first? Do i have to set the MERGE var in MailChimp first and then create the hack file? I think i can follow those instructions, but just not sure of the order. Could you clarify that?
Yes, that is correct. Otherwise, s2Member's communication with the MailChimp API will fail, because s2Member ( with your hack file ), would be trying to send data to your MailChimp account, which MailChimp is not yet configured to receive.

Also, re-re-reading the instructions for that hack file, you mention S2_CUSTOM. How do i get more than one custom var? If i have product A and product B and product C and a customer can get any one of them or any combination of 2 (or 3) even if not at the same time, how are they identified?
For the benefit of other readers, I'll re-post this in it's entirely,
and I'll modify it a bit to give you an example of adding multiple MERGE vars for each Customer.


You will probably want to seek assistance from a developer to complete this, but none the less, here is a quick example for you. This example shows how you might add custom MERGE fields into the existing defaults that s2Member already supplies with each call to the MailChimp API.

Create this directory and file:
/wp-content/mu-plugins/s2-hacks.php
Code: Select all
<?php
add_filter
("ws_plugin__s2member_mailchimp_merge_array", "my_filter");
function my_filter($merge, $vars)
    {
// $merge /* Array of existing MERGE fields that s2Member passes by default. */
// $vars /* Array of defined variables in the scope/context of this Filter. */

        $user_id = $vars["user_id"];
        // print_r($vars); // Lots of good stuff in this array.
        $user_custom = get_user_option("s2member_custom", $user_id);
        $user_role = get_user_field ("s2member_access_role", $user_id);
        $my_custom_merge_vars = array("S2_CUSTOM" => $user_custom, "S2_ROLE" => $user_role);
        return array_merge($merge, $my_custom_merge_vars);
    }
?>
* Based on this example, you would first need to add two new MERGE fields to your MailChimp list, with the names: S2_CUSTOM and S2_ROLE. See also this s2Member API Function: get_user_field(), which might be helpful when collecting certain details about a User/Member: viewtopic.php?f=40&t=12453&src_doc_v=111003#src_doc_get_user_field%28%29

Another silly question: if i already created a hack file for another task, do i just add to the same file for this?
Nope, you can put everything in one s2-hacks.php file. Or if you prefer, split things up into one file for each type of hack. The name "s2-hacks.php" is NOT required. Just make sure your file(s) have a PHP extension.

Then, maybe something for down the road, but if the user is not automatically updated (like if it is an existing user) in WP, will this variable STILL be updated in MailChimp? Meaning does the information go to MailChimp right at registration/payment or only when it comes back to s2Member? (meaning that if s2M does not update it, MailChimp wont either)
Right, this information is only processed during registration, and NOT during Profile updates. We're working on this however, for a future release.
~ Jason Caldwell / Lead Developer
& Zeitgeist Movie Advocate: http://www.zeitgeistmovie.com/

Is the s2Member plugin working for you? Please rate s2Member at WordPress.org.
You'll need a WordPress.org account ( comes in handy ). Then rate s2Member here Image
.
User avatar
Jason Caldwell
Lead Developer
Lead Developer
 
Posts: 4045
Joined: May 3, 2010
Location: Georgia / USA


Return to s2Member Plugin

Who is online

Users browsing this forum: No registered users and 2 guests

cron