function simplenews_subscription_list_add in Simplenews 7.2
Same name and namespace in other branches
- 5 simplenews.module \simplenews_subscription_list_add()
- 6.2 includes/simplenews.admin.inc \simplenews_subscription_list_add()
- 6 simplenews.admin.inc \simplenews_subscription_list_add()
- 7 includes/simplenews.admin.inc \simplenews_subscription_list_add()
Menu callback: Mass subscribe to newsletters.
@todo Add 32char description field as subsription source
See also
simplenews_subscription_list_add_submit()
1 string reference to 'simplenews_subscription_list_add'
- simplenews_menu in ./
simplenews.module - Implements hook_menu().
File
- includes/
simplenews.admin.inc, line 679 - Newsletter admin, subscription admin, simplenews settings
Code
function simplenews_subscription_list_add($form, &$form_state) {
global $language;
$form['emails'] = array(
'#type' => 'textarea',
'#title' => t('Email addresses'),
'#cols' => 60,
'#rows' => 5,
'#description' => t('Email addresses must be separated by comma, space or newline.'),
);
$form['newsletters'] = array(
'#type' => 'fieldset',
'#description' => t('Subscribe to'),
'#tree' => TRUE,
);
foreach (simplenews_newsletter_get_all() as $newsletter) {
$form['newsletters'][$newsletter->newsletter_id] = array(
'#type' => 'checkbox',
'#title' => check_plain($newsletter->name),
'#description' => check_plain($newsletter->description),
);
}
$form['resubscribe'] = array(
'#type' => 'checkbox',
'#title' => t('Force resubscription'),
'#description' => t('If checked, previously unsubscribed e-mail addresses will be resubscribed. Consider that this might be against the will of your users.'),
);
// Include language selection when the site is multilingual.
// Default value is the empty string which will result in receiving emails
// in the site's default language.
if (variable_get('language_count', 1) > 1) {
$options[''] = t('Site default language');
$languages = language_list('enabled');
foreach ($languages[1] as $langcode => $item) {
$name = t($item->name);
$options[$langcode] = $name . ($item->native != $name ? ' (' . $item->native . ')' : '');
}
$form['language'] = array(
'#type' => 'radios',
'#title' => t('Anonymous user preferred language'),
'#default_value' => '',
'#options' => $options,
'#description' => t('New subscriptions will be subscribed with the selected preferred language. The language of existing subscribers is unchanged.'),
);
}
else {
$form['language'] = array(
'#type' => 'value',
'#value' => '',
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Subscribe'),
);
return $form;
}