function simplenews_subscription_list_add in Simplenews 6
Same name and namespace in other branches
- 5 simplenews.module \simplenews_subscription_list_add()
- 6.2 includes/simplenews.admin.inc \simplenews_subscription_list_add()
- 7.2 includes/simplenews.admin.inc \simplenews_subscription_list_add()
- 7 includes/simplenews.admin.inc \simplenews_subscription_list_add()
Menu callback: Mass subscribe to newsletters.
See also
simplenews_subscription_list_add_submit()
1 string reference to 'simplenews_subscription_list_add'
- simplenews_menu in ./
simplenews.module - Implementation of hook_menu().
File
- ./
simplenews.admin.inc, line 379 - Newsletter admin, subscription admin, simplenews settings
Code
function simplenews_subscription_list_add() {
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.'),
);
$newsletters = array();
foreach (taxonomy_get_tree(variable_get('simplenews_vid', '')) as $newsletter) {
$newsletters[$newsletter->tid] = check_plain($newsletter->name);
}
$form['newsletters'] = array(
'#type' => 'checkboxes',
'#title' => t('Subscribe to'),
'#options' => $newsletters,
'#required' => TRUE,
);
// 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('Anonymous users will be subscribed with the selected preferred language. They will receive newsletters in this language if available. Registered users will be subscribed with their preferred language as set on their account page.'),
);
}
else {
$form['language'] = array(
'#type' => 'value',
'#value' => '',
);
}
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Subscribe'),
);
return $form;
}