function notifications_autosubscribe_form_alter in Notifications 6.4
Same name and namespace in other branches
- 5 notifications_autosubscribe/notifications_autosubscribe.module \notifications_autosubscribe_form_alter()
- 6 notifications_autosubscribe/notifications_autosubscribe.module \notifications_autosubscribe_form_alter()
- 6.2 notifications_autosubscribe/notifications_autosubscribe.module \notifications_autosubscribe_form_alter()
- 6.3 notifications_autosubscribe/notifications_autosubscribe.module \notifications_autosubscribe_form_alter()
Implementation of hook_form_alter()
Adds autosubscribe checkbox to user edit form.
File
- notifications_autosubscribe/
notifications_autosubscribe.module, line 65 - Notifications Autosubscribe module.
Code
function notifications_autosubscribe_form_alter(&$form, $form_state, $form_id) {
switch ($form_id) {
case 'user_edit':
case 'user_profile_form':
if (isset($form['messaging'])) {
$form['messaging']['notifications_auto'] = array(
'#type' => 'checkbox',
'#title' => t('Autosubscribe'),
'#default_value' => notifications_user_setting('auto', $form['_account']['#value']),
'#description' => t('Checking this box allows you to automatically subscribe to any thread you create or post a comment to.'),
);
}
break;
case 'notifications_content_settings_form':
$form['autosubscribe'] = array(
'#type' => 'fieldset',
'#title' => t('Autosubscribe'),
'#weight' => -10,
);
$form['autosubscribe']['notifications_default_auto'] = array(
'#type' => 'checkbox',
'#title' => t('Set all users to "autosubscribe" by default'),
'#default_value' => variable_get('notifications_default_auto', 0),
'#description' => t("If checked the option will be 'enabled' by default for user account settings. This won't change existing settings for users who have already defined it."),
);
break;
}
}