You are here

function _mailchimp_load_user_list_mergevars in Mailchimp 6.2

Same name and namespace in other branches
  1. 5.2 mailchimp.module \_mailchimp_load_user_list_mergevars()
  2. 5 mailchimp.module \_mailchimp_load_user_list_mergevars()
  3. 6 mailchimp.module \_mailchimp_load_user_list_mergevars()
  4. 7 mailchimp.module \_mailchimp_load_user_list_mergevars()

Get the relevent merge vars for the given user for the given list

4 calls to _mailchimp_load_user_list_mergevars()
mailchimp_cron in ./mailchimp.module
Implementation of hook_cron.
mailchimp_subscribe_auth_form_submit in ./mailchimp.module
Submit handler to add users to lists when editing/creating a user
mailchimp_user in ./mailchimp.module
Implementation of hook_user
_mailchimp_subscribe_anon_form in ./mailchimp.module
Helper function to return form elements for a single anon newsletter

File

./mailchimp.module, line 929
Mailchimp module.

Code

function _mailchimp_load_user_list_mergevars($uid, $list_id, $mergevars) {
  $account = mailchimp_get_merge_values($uid);
  $lists = variable_get('mailchimp_lists', array());
  $list = $lists[$list_id];
  $uservars = array(
    'EMAIL' => $account['mail'],
  );
  foreach ($mergevars as $mergevar) {
    if (!empty($list->mergevars[$mergevar['tag']]) && ($key = $list->mergevars[$mergevar['tag']])) {
      $uservars[$mergevar['tag']] = $account[$key];
    }
  }
  return $uservars;
}