Merge Documentation | MailChimp | Drupal
Last Updated on Wednesday, 01 June 2011 14:01 Written by Nicholas Dunbar
If you installed the drupal MailChimp Module you might want to know how to "Merge Variables"
If you were like me you created a list on mailchimp
Added the Drupal MailChimp Module,
enabled it
went to admin/settings/mailchimp
added the API keys to your installed Drupal MailChimp Module
Hit save
synced it with your account
opened the mail list
and at the bottom you wanted to add your own custom data to each mail added to your list where it says:
"Merge Variables
Select Drupal user variables to send to Mailchimp as Merge Variables. Available Drupal variables are any Profile or Token variables for the given user. For more information on Merge Variables, see the Mailchimp Documentation. Not that some fields, such as ADDRESS fields which are multi-part, cannot be merged with a single token value."
accept there is no drop downs under the list.and when you click on Mailchimp Documentation it takes you to a broken URL.
So I went to my mail chimp account and I added the variables at
admin.mailchimp.com/lists/settings/merge-tags
(note this url will give you an idea of where to look but might not be the same for all accounts)
then I went back to my drupal mailchimp admin (admin/settings/mailchimp)
I clicked, under "MailChimp cron"
rebuild the MailChimp user table
then when I access the mail lists there is a list of posible drupal data I can merge or attach to my mailchimp account.
But there is a limited amount of choices.
-----------Everything below is for adding your own custom tokens to mailchimp---------------
-----------however this next part will only get you on the right track it is half the---------------
-----------solution, I never had time to completely solve this problem-------------------------
So....
What if I want to control what choices are there?
First download the Token Drupal Module, install it and enable it
Then dowload the Custom Tokens Module, install it and enable it
Add your custom tokens to the custom token module in the backend under admin/build/tokens
Now here is where you hack your mailchimp module
Find \modules\mailchimp\mailchimp.module
open the file and find the function mailchimp_mailchimp_merge_keys()
at the very bottom of the function add the following code:
