You are here

function _mailchimp_get_available_lists in Mailchimp 6.2

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

Get all of the lists that the given user can subscribe to

5 calls to _mailchimp_get_available_lists()
mailchimp_block in ./mailchimp.module
implementation of hook_block Provides a block for each available list for a given user
mailchimp_subscribe_anon_form_all in ./mailchimp.module
Return a form for all available MC lists
mailchimp_subscribe_auth_form in ./mailchimp.module
Maichimp authenticated user subscription form.
mailchimp_unsubscribe_form_submit in ./mailchimp.module
submit handler for unsubscribe form
mailchimp_user in ./mailchimp.module
Implementation of hook_user

File

./mailchimp.module, line 1020
Mailchimp module.

Code

function _mailchimp_get_available_lists($user) {
  $all_lists = variable_get('mailchimp_lists', array());
  $available_lists = array();
  if (!empty($all_lists)) {
    foreach ($all_lists as $key => $list) {
      foreach ($user->roles as $rid => $info) {
        if (!empty($list->roles[$rid])) {
          $available_lists[$list->id] = $list;
          break;
        }
      }
    }
  }
  return $available_lists;
}