Tips and Tricks HQ Support Portal › Forums › WP eMember › MailChimp Integration
Tagged: form data, mail chimp, mailchimp, mailchimp list, member level
- This topic has 11 replies, 5 voices, and was last updated 13 years, 2 months ago by ddeo.
-
AuthorPosts
-
October 14, 2010 at 3:06 pm #2025intern007Member
Hi,
how do I go about passing a few extra fields from the registration form to MailChimp (e.g. the state and province fields). I would like when new users signup to be automatically signed up with MailChimp but I need to get their address information as well over to MailChimp?
Regards
October 15, 2010 at 2:37 am #25458amin007ParticipantYou will need to modify the “eMember_auto_responder_handler.php” file which handles the signup:
Search for the following function which does the actual signup:
eMember_mailchimp_subscribe
Follow the trail of where the function gets called from so you can pass in the other data to this function.
October 15, 2010 at 7:58 am #25459intern007MemberThanks
February 1, 2011 at 6:58 pm #25460hoffybalboaMemberThis is good, but is it possible to get more detailed information about this? I would like to at the very least pass the WordPress Username and Phone to mailchimp. Could you help mark up the actual code below, to show us non-coders, how to pass username and phone?
Here is the code from eMember_mailchimp_subscribe:
function eMember_mailchimp_subscribe($api,$target_list_name,$fname,$lname,$email_to_subscribe)
{
$lists = $api->lists();
foreach ($lists AS $list)
{
if ($list == $target_list_name)
{
$list_id = $list;
}
}
$merge_vars = array(‘FNAME’=>$fname, ‘LNAME’=>$lname,
‘INTERESTS’=>”);
$retval = $api->listSubscribe( $list_id, $email_to_subscribe, $merge_vars );
return $retval;
}
Thank you
February 2, 2011 at 4:06 am #25461amin007ParticipantIts not that simple as the phone number and the WordPress username is not passed to this function. So the first thing you will need to do is pass the WordPress username and the phone number to this function then I will be able to give you help with the markup.
February 2, 2011 at 4:30 am #25462hoffybalboaMemberPardon my ignorance, but I do not understand or how to proceed.
March 11, 2011 at 3:46 pm #25463dkbrainardMemberWhen I installed WP eMember plugin, I had about 700 people subscribed to my legacy list.
In configuring MailChimp, we set up three membership levels
None – legacy subscribers
Free – eMember free subscribers
Premium – eMember paid subscribers
When my legacy members sign up for my member site in eMember, this change isn’t reflected in MailChimp data. (I.e. eMember shows them as Free or Premium members but MailChimp still shows member level as None).
How can I send the changed member level to Mail Chimp for pre-existing subscribers?
Thanks – I have both eStore and eMember and the plug-ins are fantastic.
DK Brainard
March 12, 2011 at 12:17 am #25464amin007ParticipantThe plugin only signs up a user to a particular list. It doesn’t not send any membership level data to MailChimp.
March 12, 2011 at 1:47 am #25465dkbrainardMemberThanks Amin. The integration between eMember and Mail Chimp does seem to be working to the effect that when one of my legacy users becomes a Free Member on my site, it doesn’t add a duplicate list entry on Mail Chimp. So that’s cool. Wish there was a way to send the membership level over, though.
September 1, 2011 at 3:25 pm #25466ddeoMemberHello, has anyone figured out how to pass more e-member field data to mailchimp? I have been looking at the emember code and the MCAPI code for hours and i don’t have enough smarts to figure this out. In the MCAPI it says that other field data can be passed through
array $merge_vars array of merges for the email (FNAME, LNAME, etc.)
I edited the file eMember_auto_responder_handler.php like this:
function eMember_mailchimp_subscribe($api,$target_list_name,$fname,$lname,$company,$email_to_subscribe)
{
$lists = $api->lists();
foreach ($lists AS $list)
{
if ($list['name'] == $target_list_name)
{
$list_id = $list['id'];
}
}
$merge_vars = array('FNAME'=>$fname, 'LNAME'=>$lname, 'COMPANY'=>$company,
'INTERESTS'=>'');and
function eMember_global_autoresponder_signup($firstname,$lastname,$company_name,$emailaddress)
{
if ($emember_config->getValue('eMember_use_mailchimp') == 1)
{
$api = eMember_get_chimp_api();
$target_list_name = $emember_config->getValue('eMember_chimp_list_name');
$retval = eMember_mailchimp_subscribe($api,$target_list_name,$firstname,$lastname,$company_name,$emailaddress);
eMember_log_debug('Mailchimp email address to signup:'.$emailaddress,true);
eMember_log_debug('Mailchimp list to signup to:'.$target_list_name,true);
eMember_log_debug('Mailchimp signup operation performed. returned value:'.$retval,true);
}
}Once I added $company_name to the eMember_global_autoresponder_signup function it seems to have brokent hte connection with mailchimp. here is the output from my log file:
[09/01/2011 3:15 PM] - SUCCESS :Performing global autoresponder signup if specified.
[09/01/2011 3:15 PM] - SUCCESS :Mailchimp email address to signup:
[09/01/2011 3:15 PM] - SUCCESS :Mailchimp list to signup to:Web Customers
[09/01/2011 3:15 PM] - SUCCESS :Mailchimp signup operation performed. returned value:
[09/01/2011 3:15 PM] - SUCCESS :End of global autoresponder signup.the return value should be 1
Also, I did add the mergtag ‘COMPANY’ in my mailchimp account..
Am I missing something. Please help me because I think I am close to figuring this out. Possibly the variable for company in e-member is not right. should it be $wp_emember_company_name or something else?
Your help is greatly appreciated. Thanks, Ddeo
September 1, 2011 at 4:00 pm #25467ddeoMemberUpdate:
So I removed the variable $company_name from the eMember_global_autoresponder_signup because after looking at that again it doesn’t work with mail chimp.
So now when I register a new user it gets added to mailchimp but nothing is entered for company. I tried the variable $company too and that doesn’t work.
Can anyone tell me how to pass this variable into the mergetag? Thanks! Ddeo
September 1, 2011 at 7:16 pm #25468ddeoMemberFinally figured it out. Just needed to go out and get lunch for a bit.
Needed to edit:
eMember_registration_utils.php
/*** Signup the member to Autoresponder List (Autoresponder integration) ***/ eMember_global_autoresponder_signup($_POST,$_POST,$_POST,$_POST);
/*** end of autoresponder integration ***/
-
AuthorPosts
- You must be logged in to reply to this topic.