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.

Mail Chimp Integration

Home Forums Community Forum Mail Chimp Integration

This topic contains 1 reply, has 2 voices. Last updated by  Eduan 4 years, 1 month ago.

Topic Author Topic
Posted: Sunday Nov 18th, 2012 at 12:12 am #31911
Rahul Baji
Username: RahulB

I spent quite a few hours getting my custom profile fields into MailChimp.

My custom fields were
Gender [s2member unique id was gender]
Age [s2member unique id was age]
Country [s2member unique id was country_code]
created through
S2Member->General Settings-> Registration/Profile Fields

I created similar list fields in Mailchimp GENDER, AGERANGE, COUNTRY

Sharing the code that worked.

I added the following function to my theme functions.php

add_filter("ws_plugin__s2member_mailchimp_merge_array", "my_filter",10,2);
function my_filter($merge, $vars)
{
$user_id = $vars['user_id'];
$gender = get_user_field ("gender", $user_id);
$age = get_user_field ("age", $user_id);
$country = get_user_field ("country_code", $user_id);
$my_custom_merge_vars = array("GENDER" => $gender, "AGERANGE" => $age, "COUNTRY" =>$country);
return array_merge($merge, $my_custom_merge_vars);
}

Hope this spares some hours for somebody else trying to do the same. I guess this could be optimised by getting all the fields into an array once. But since this worked, I am going ahead with this.

  • This topic was modified 4 years, 1 month ago by  Rahul Baji. Reason: correction1
  • This topic was modified 3 years, 4 months ago by  Rahul Baji.

List Of Topic Replies

Viewing 1 replies (of 1 total)
Author Replies
Author Replies
Posted: Sunday Nov 18th, 2012 at 11:10 am #31929
Eduan
Username: Eduan
Moderator

That’s great Rahul! Thanks for sharing this solution. :)

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.