You are here

function mailchimp_mailchimp_merge_values in Mailchimp 6.2

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

Implementation of hook_mailchimp_merge_values

File

./mailchimp.module, line 872
Mailchimp module.

Code

function mailchimp_mailchimp_merge_values($user) {
  $out = array();
  $out = (array) $user;
  foreach ((array) $user as $key => $value) {

    // handle profile dates
    if (is_array($value) && isset($value['month'])) {
      $out[$key] = date('Y-m-d', strtotime(implode('/', $value)));
    }
    else {
      if (in_array($key, array(
        'login',
        'access',
        'created',
      ))) {
        $out[$key] = date('c', $value);
      }
      else {
        if ($key != 'roles') {
          $out[$key] = $value;
        }
      }
    }
  }
  $out = array_merge($out, _mailchimp_get_user_tokens($user));
  return $out;
}