You are here

function constant_contact_get_lists in Constant Contact 6.3

Same name and namespace in other branches
  1. 5 constant_contact.module \constant_contact_get_lists()
  2. 6 constant_contact.module \constant_contact_get_lists()
  3. 7.3 constant_contact.module \constant_contact_get_lists()

Helpful function to get the contact lists

11 calls to constant_contact_get_lists()
constant_contact_add_list_form_submit in ./admin.lists.inc
Submit handler for the add contact list admin page
constant_contact_delete_list_form_submit in ./admin.lists.inc
Submit handler for the delete contact list admin page
constant_contact_edit_list_form_submit in ./admin.lists.inc
Submit handler for the add contact list admin page
constant_contact_export in ./admin.export.inc
Displays the export page
constant_contact_form_user_register_alter in ./constant_contact.module
Alter the user registration form

... See full list

File

./constant_contact.module, line 1298

Code

function constant_contact_get_lists(&$cc, $exclude = 3, $bypass_cache = false) {

  // if some cached data exists and we are not bypassing the cache use the cached data
  if (!$bypass_cache and $cached = cache_get('cc_lists', 'cache')) {
    return $cached->data;
  }
  $_lists = $cc
    ->get_all_lists('lists', $exclude, 'constant_contact_sort_lists');
  $lists = array();
  if ($_lists) {
    foreach ($_lists as $k => $v) {
      $lists[$v['id']] = $v['Name'];
    }
  }

  // save to the cache
  $expire = variable_get('cc_lists_cache_expire', CC_CONTACT_LISTS_CACHE_EXPIRE);
  cache_set('cc_lists', $lists, 'cache', time() + $expire);
  return $lists;
}