You are here

function mailchimp_lists_user_subscribe_page in Mailchimp 7.2

Page callback for a user newsletter subscription page.

1 string reference to 'mailchimp_lists_user_subscribe_page'
mailchimp_lists_menu in modules/mailchimp_lists/mailchimp_lists.module
Implements hook_menu().

File

modules/mailchimp_lists/mailchimp_lists.module, line 400
Mailchimp lists module.

Code

function mailchimp_lists_user_subscribe_page($account) {

  // Get all available non-required lists:
  $non_required_lists = mailchimp_lists_get_available_lists($account, array(
    'show_account_form' => 1,
    'required' => FALSE,
  ));
  $required_lists_with_interest_groups = mailchimp_lists_get_available_lists($account, array(
    'required' => 1,
    'include_interest_groups' => 1,
  ));
  $lists = array_merge($non_required_lists, $required_lists_with_interest_groups);
  if (count($lists) == 0) {
    return t('There are no available newsletter subscriptions.');
  }
  $form = drupal_get_form('mailchimp_lists_user_subscribe_form', $lists, $account);
  $form['submit']['#value'] = t('Save');
  return $form;
}