Hi,
It would be nice if a module_invoke_all or drupal_alter can allow users to alter the mergevars values.
I hacked function mailchimp_lists_process_subscribe_form_choices into mailchimp_lists.module to add the "user language" like this:
global $language;
$lang = $language->language;
if( !$is_anonymous && isset( $account->language ) && !empty( $account->language ) )
$lang = $account->language;
$mergevars['MC_LANGUAGE'] = $lang;
With this code, user is registred to mailchimp with the language of it's Drupal account (or current language for anonymous users), and I can :
- fragment my subscribers by language
- add conditional if/else in mail templates based on language (*|IF:MC_LANGUAGE=en|* ... *|ELSE:|* ... *|END:IF|*) to send translated mails
If a
drupal_alter( 'mailchimp_lists_mergevars', $mergevars, $account );
can be added in mailchimp_lists_process_subscribe_form_choices function it would be helpful.
Comments
Comment #1
Shven commentedWith a form_alter you can get the same result without hacking a contrib module.
Comment #2
amytswan commented“And now our watch [for support of the 7.x-2.x version of the MailChimp module] has ended…” With the approaching deprecation of MailChimp’s API version 2.0, I’m sad to say we too must turn the page. This branch will become unsupported in early October and officially deprecated by the end of this year (2016).
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. If you find this issue still exists on either the 7.x-4.x or 8.x branches, let us know by opening a new ticket. “What is dead may never die, but rises again, harder and stronger!”