function notify_user_settings_form in Notify 6
Same name and namespace in other branches
- 5.2 notify.module \notify_user_settings_form()
- 5 notify.module \notify_user_settings_form()
- 7 notify.admin.inc \notify_user_settings_form()
Menu callback; show user notification options.
1 string reference to 'notify_user_settings_form'
- notify_menu in ./
notify.module - Implementation of hook_menu().
File
- ./
notify.module, line 262 - Notify module sends email digests of new content and comments.
Code
function notify_user_settings_form(&$form_state, $arg) {
global $user;
if ($user->uid != $arg->uid && !user_access('administer notify')) {
drupal_access_denied();
return;
}
$account = user_load(array(
'uid' => $arg->uid,
));
if (!is_object($account)) {
drupal_not_found();
return;
}
$result = db_query('SELECT u.uid, u.name, u.mail, n.status, n.node, n.teasers, n.comment FROM {users} u LEFT JOIN {notify} n ON u.uid = n.uid WHERE u.uid = %d AND u.status = 1', $account->uid);
$notify = db_fetch_object($result);
$form = array();
if (!$notify->mail) {
drupal_set_message(t('Your e-mail address must be specified on your <a href="@url">my account</a> page.', array(
'@url' => url('user/' . $account->uid . '/edit'),
)), 'error');
}
$form['notify_page_master'] = array(
'#type' => 'fieldset',
'#title' => t('Master switch'),
);
$form['notify_page_master']['status'] = array(
'#type' => 'radios',
'#title' => t('Notify status'),
'#default_value' => $notify->status,
'#options' => array(
t('Disabled'),
t('Enabled'),
),
'#description' => t('Do you wish to receive periodic e-mails when new content is posted?'),
);
$form['notify_page_detailed'] = array(
'#type' => 'fieldset',
'#title' => t('Detailed settings'),
);
$form['notify_page_detailed']['node'] = array(
'#type' => 'radios',
'#title' => t('Notify new content'),
'#default_value' => $notify->node,
'#options' => array(
t('Disabled'),
t('Enabled'),
),
'#description' => t('Include new posts in the notification mail.'),
);
$form['notify_page_detailed']['teasers'] = array(
'#type' => 'radios',
'#title' => t('Content'),
'#default_value' => $notify->teasers,
'#options' => array(
t('Title only'),
t('Title + Teaser'),
t('Title + Body'),
),
'#description' => t('Select the amount of each post that you would like to see in your notification e-mails.'),
);
$form['notify_page_detailed']['comment'] = array(
'#type' => 'radios',
'#title' => t('Notify new comments'),
'#default_value' => $notify->comment,
'#options' => array(
t('Disabled'),
t('Enabled'),
),
'#description' => t('Include new comments in the notification mail.'),
);
$form['uid'] = array(
'#type' => 'value',
'#value' => $account->uid,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save settings'),
);
return $form;
}