You are here

function mailchimp_subscribe in Mailchimp 7.5

Same name and namespace in other branches
  1. 8 mailchimp.module \mailchimp_subscribe()
  2. 7.3 mailchimp.module \mailchimp_subscribe()
  3. 7.4 mailchimp.module \mailchimp_subscribe()
  4. 2.x mailchimp.module \mailchimp_subscribe()

Subscribe a user to a MailChimp list in real time or by adding to the queue.

Return value

bool True on success.

See also

Mailchimp_Lists::subscribe()

3 calls to mailchimp_subscribe()
MailchimpListsTestCase::testSubscribe in modules/mailchimp_lists/tests/mailchimp_lists.test
Tests subscribing a member to a list.
mailchimp_lists_process_subscribe_form_choices in modules/mailchimp_lists/mailchimp_lists.module
Processor for various list/audience form submissions.
mailchimp_signup_subscribe_form_submit in modules/mailchimp_signup/mailchimp_signup.module
Submit handler to add users to lists/audiences on subscription form submission.

File

./mailchimp.module, line 695
Mailchimp module.

Code

function mailchimp_subscribe($list_id, $email, $merge_vars = NULL, $interests = array(), $double_optin = FALSE, $format = 'html', $gdpr_consent = FALSE) {
  if (variable_get('mailchimp_cron', FALSE)) {
    $args = array(
      'list_id' => $list_id,
      'email' => $email,
      'merge_vars' => $merge_vars,
      'interests' => $interests,
      'double_optin' => $double_optin,
      'format' => $format,
      'gdpr_consent' => $gdpr_consent,
    );
    return mailchimp_addto_queue('mailchimp_subscribe_process', $args);
  }
  return mailchimp_subscribe_process($list_id, $email, $merge_vars, $interests, $double_optin, $format, $gdpr_consent);
}