You are here

function _mailchimp_get_api_object in Mailchimp 7

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

Get a Mailchimp API object for communication with the mailchimp server

13 calls to _mailchimp_get_api_object()
mailchimp_block_view in ./mailchimp.module
Implements hook_block_view(). Provides a block for each available list for a given user
mailchimp_cron in ./mailchimp.module
Implements hook_cron().
mailchimp_subscribe_auth_form in ./mailchimp.module
Add mailchimp form fields to account and registration forms
mailchimp_subscribe_auth_form_submit in ./mailchimp.module
Submit handler to add users to lists when editing/creating a user
mailchimp_subscribe_page in ./mailchimp.module
Return all available MC lists a given user can subscribe to

... See full list

File

./mailchimp.module, line 911
Mailchimp module.

Code

function _mailchimp_get_api_object() {
  module_load_include('php', 'mailchimp', 'MCAPI.class');
  $q = new MCAPI(variable_get('mailchimp_api_key', ''));

  // set the timeout to something reasonable to avoid taking down the Drupal site
  $q
    ->setTimeout(60);
  if ($q->errorCode) {
    watchdog('mailchimp', 'MCAPI Error: %errmsg', array(
      '!errmsg' => $q->errorMessage,
    ), WATCHDOG_ERROR);
    return NULL;
  }
  return $q;
}