function mailchimp_subscribe_auth_form in Mailchimp 6.2
Same name and namespace in other branches
- 7 mailchimp.module \mailchimp_subscribe_auth_form()
Maichimp authenticated user subscription form.
3 string references to 'mailchimp_subscribe_auth_form'
- mailchimp_forms in ./
mailchimp.module - Implementation of hook_forms().
- mailchimp_menu in ./
mailchimp.module - Implementation of hook_menu.
- mailchimp_subscribe_page in ./
mailchimp.module - Return all available MC lists a given user can subscribe to
File
- ./
mailchimp.module, line 151 - Mailchimp module.
Code
function mailchimp_subscribe_auth_form($form_state, $account, $standalone = TRUE, $list = NULL) {
$form = array();
if ($q = _mailchimp_get_api_object()) {
if ($account->uid) {
$form['uid'] = array(
'#type' => 'hidden',
'#value' => $account->uid,
);
}
else {
// user registration or admin creating new user
$account->roles = array(
2 => 'authenticated',
);
}
$lists = array();
if (empty($list)) {
$lists = _mailchimp_get_available_lists($account);
}
else {
$lists[$list->id] = $list;
}
foreach ($lists as $list) {
mailchimp_auth_newsletter_form($form, $list, $account, $q);
}
$form['lists'] = array(
'#type' => 'value',
'#value' => $lists,
);
if ($standalone) {
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('save settings'),
'#weight' => 100,
);
$form['#submit'][] = 'mailchimp_subscribe_auth_form_submit';
}
}
return $form;
}