Home › Forums › Community Forum › Custom profile and Mailchimp
This topic contains 8 replies, has 2 voices. Last updated by Cristián Lávaque 3 years, 4 months ago.
Topic Author | Topic |
---|---|
Posted: Tuesday Aug 20th, 2013 at 1:03 am #56216 | |
|
|
I have searched extensively and for many hours for an answer and cannot find it in these forums. What is required to have the custom profile data to be sent to Mailchimp when a user registers? I have added the API and list code to S2 member. I have added custom fields to S2m and when a user registers the data is saved in WP perfectly. Only the new user’s names and email address is sent to mailchimp. Do you have to put the custom field name or data ID into mailchimp somewhere? Do the field names in WP have to be in a certain format for mailchimp to take their data, such as all caps, a maximum length, etc? I have seen some posts that discuss more detailed programming, but the instruction in S2m Options don’t mention any of that. Thanks in advance for your help. |
List Of Topic Replies
Author | Replies |
---|---|
Author | Replies |
Posted: Thursday Aug 22nd, 2013 at 1:40 am #56403 | |
|
|
Custom profile fields are not something s2Member includes when sending the user data to MailChimp, that’s why it’s not described in the integration’s documentation, it needs a customization similar to the one you found in other threads to achieve it. When you created the custom profile field, you gave it an ID. You can get the value of that field for the user using that id with the function get_user_field. http://s2member.com/codex/stable/s2member/api_functions/package-functions/#src_doc_get_user_field%28%29 Here’s an example with two custom fields I made up (country, phone): Create this dir/file: /wp-content/mu-plugins/s2-hacks.php get_user_field('country', $vars['user_id']), 'phone' => get_user_field('phone', $vars['user_id']), ); return array_merge($merge, $custom_merge); So you’d use your own custom field IDs instead of the ones I put in the example, and you can add more if you have more than two. I hope that helps. :) |
|
Posted: Thursday Aug 22nd, 2013 at 9:39 am #56442 | |
|
|
Thank you for the clarification, however I followed your instructions and the data did not get into Mailchimp. I created the mu-plugins folder and uploaded the s2-hacks.php file which contained the following:
And I received the following email from Mailchimp after their confirmation email.
And here is the Mailchimp log file from S2Member:
Hope this helps find the problem. Thanks again. |
|
Posted: Wednesday Aug 28th, 2013 at 7:46 am #58780 | |
|
|
Sorry, I just saw your reply. Thanks for the info. It looks like the hack works, it’s sending the data for those fields. What doesn’t seem to be happening is MailChimp saving it. I wonder if they changed something on their side since the hack was written. I don’t have a MailChiimp account to test this with. I’ll ask Jason about it and let you know when I hear back from him. |
|
Posted: Wednesday Aug 28th, 2013 at 8:43 am #58795 | |
|
|
Here’s what Jason said:
Have you created those fields in MailChimp with those exact IDs/names? |
|
Posted: Wednesday Aug 28th, 2013 at 9:26 am #58801 | |
|
|
BTW, I thought I had posted this on the Customer Forum. I have paid for Pro. That solved the problem for some of the fields. Before you replied to my first posting, I tried to match the field names in S2member with Mailchimp and ran into a problem. It appears that the Mailchimp field names are limited to 10 characters. In S2member I have default fields such as Last Payment Date and custom fields such as “spouse_name” that are longer than 10. Not knowing how to change the default length in mailchimp, or if it would recognize just the first 10 characters and be okay, I changed the field names in S2members. Unfortunately, doing that caused the data that had been entered by users to disappear. None of this mattered at that time because I didn’t know that I had to customize the program as you explained. I tried changing the fields today in Mailchimp and it now works for those S2member fields that are 10 characters or less, but not for those longer field names. Is there a way to change the filed names in S2member without losing the data that has been entered? Thanks again for your help. |
|
Posted: Thursday Aug 29th, 2013 at 7:49 am #58841 | |
|
|
Thanks for the update. If renaming the profile field is causing you trouble, what you could do is take care of it in the hack. The merge field names don’t have to match the s2Member profile field names. For example: [hilite pre_code]get_user_field('ID', $vars['user_id']), 'role' => get_user_field('Role', $vars['user_id']), 'reg_date' => get_user_field('Registration Date', $vars['user_id']), 'eot_date' => get_user_field('Auto-EOT Date', $vars['user_id']), 'nickname' => get_user_field('Nick_Name', $vars['user_id']), 'birthday' => get_user_field('birth_date', $vars['user_id']), 'street_1' => get_user_field('Street_Address', $vars['user_id']), 'street_2' => get_user_field('Address_2nd', $vars['user_id']), 'city' => get_user_field('City', $vars['user_id']), 'state' => get_user_field('State', $vars['user_id']), 'zip' => get_user_field('Zip', $vars['user_id']), 'phone_1' => get_user_field('Home_Phone', $vars['user_id']), 'phone_2' => get_user_field('Other_Phone', $vars['user_id']), 'spouse' => get_user_field('Spouse_Name', $vars['user_id']), 's_birth' => get_user_field('spouse_birth', $vars['user_id']), 'directory' => get_user_field('Directory', $vars['user_id']), ); return array_merge($merge, $custom_merge); Of course, the array keys would match the merge field names you created in MailChimp. I hope that helps. :) |
|
Posted: Thursday Aug 29th, 2013 at 10:35 pm #58868 | |
|
|
That did it. Thanks very much. |
|
Posted: Thursday Aug 29th, 2013 at 11:18 pm #58872 | |
|
|
Excellent! I’m glad that did it. Thank you for the update. :) If it’s not too much to ask for, would you take a moment to rate s2Member and leave a comment over at wordpress.org? http://www.s2member.com/r/wp-rate/ A Facebook “like” would be great too! https://www.facebook.com/s2Member Thanks in advance! :) |
This topic is closed to new replies. Topics with no replies for 2 weeks are closed automatically.