I configured the module to send some variables with it.

I use the content profile module and configured the name and first name variables as 2 token values.

This does not work. The values aren't submitted to my mailchimp account. When I use the normal profile field user name it does work.

Comments

cduwe’s picture

I've got roughly the same setup. When a new user registers to the site they've filled out the content profile details but MailChimp module tries to subscribe the new user before the content profile is actually created so the subscription fails because the tokens aren't valid yet. Any ideas on how to adjust the order of execution there?

levelos’s picture

Status: Active » Closed (fixed)

This should be taken care of via #998862: Increase system weight of mailchimp module. If this was a new install, I just committed an update so the system weight is also updated then.

cduwe’s picture

Yeah, I thought of that so I edited the value of MC and reinstalled but it doesn't seem to have an effect. I spent a bunch of time trying to troubleshoot this and my original theory doesn't seem to be correct; I think the content profile data is there but for some reason MC isn't able to access it.

I was trying to make the MC newsletter "required." Since that wasn't working but manually subscribing/unsubscribing was I made a custom rule for the rules module trying to figure out a solution for the client and when that rule ran it couldn't get the content profile token data either.

In the end, I just updated the message the system sends the admin to ask them to approve a new user on the site with, "and don't forget to go here (link to MC subscription page) and subscribe this new user to the newsletter."

SMerriman’s picture

Status: Closed (fixed) » Active

Same problem here. Using content_profile fields as merge tags aren't working on registration. From what I can tell, this is because the content_profile creation occurs after the user is created (and has to, so that it can connect it to the user id), but the mailchimp subscription happens when the user is created in hook_user('insert') (and thus before any other submit hooks into the registration form).

I believe this could be fixed by moving the code from hook_user into a custom submit hook for the user register form - this would then be run after content_profile and everything else. Any issues with that?

SMerriman’s picture

Status: Active » Closed (fixed)

Actually, that's not the cause; I think this is more of a bug inside the content profile module. For anyone else interested - when the user tokens are generated, content_profile_load is called and is empty. The empty value then gets cached for the remainder of the page load, meaning when it becomes time to find the real tokens, the content isn't being loaded. My hacked solution for now is to hook in and call content_profile_load with the reset parameter = TRUE before mailchimp calculates the merge variables, but this should probably be changed in the content_profile module, not here.

langworthy’s picture

Version: 6.x-2.4 » 6.x-2.6
Component: Code » General
Status: Closed (fixed) » Active

Can you explain #5 more clearly?

As I understand it content_profile creates the user tokens. As explained in #4 the profile node is created during a submit function. Since mailchimp subscribes users during hook_user('insert') the subscription will always happen before the user is created and therefore before the profile is created. mailchimp.module will never have an opportunity to get the merge variables from the profile.

Maybe I'm missing something?

nrackleff’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

“And now our watch [for support of the 6.x version of the MailChimp module] has ended…” With the end of Drupal 6 support, I’m sad to say we too must turn the page.

Fret not! The 7.x-4.x and 8.x versions come highly recommended. Both are using Mailchimp’s new API 3.0 and are being actively maintained. “What is dead may never die, but rises again, harder and stronger!”