function subscriptions_user_settings_form_submit in Subscriptions 6
Same name and namespace in other branches
- 5.2 subscriptions.admin.inc \subscriptions_user_settings_form_submit()
User settings subform submit handler.
File
- ./
subscriptions.admin.inc, line 682 - Subscriptions module (load-on-demand admin functions).
Code
function subscriptions_user_settings_form_submit($form, &$form_state) {
$uid = subscriptions_arg(1, 'uid');
if (isset($form_state['values']['reset']) && $form_state['values']['op'] == $form_state['values']['reset']) {
if ($uid > 0) {
db_query("UPDATE {subscriptions_user} SET digest = -1, send_interval = -1, send_updates = -1, send_comments = -1, send_interval_visible = -1, send_updates_visible = -1, send_comments_visible = -1, autosub_on_post = -1, autosub_on_update = -1, autosub_on_comment = -1, send_self = -1 WHERE uid = %d", $uid);
drupal_set_message(t('The site defaults were restored.'));
}
}
elseif ($form_state['values']['op'] == $form_state['values']['save']) {
if (subscriptions_arg(0) != 'user') {
$uid = -DRUPAL_AUTHENTICATED_RID;
if (variable_get('subscriptions_hide_overview_page', 0) != $form_state['values']['hide_overview_page']) {
variable_set('subscriptions_hide_overview_page', $form_state['values']['hide_overview_page']);
menu_rebuild();
}
}
$send_interval_visible = 1 - $form_state['values']['send_interval_visible'];
$send_updates_visible = 1 - $form_state['values']['send_updates_visible'];
$send_comments_visible = 1 - $form_state['values']['send_comments_visible'];
db_query("\n UPDATE {subscriptions_user}\n SET digest = %d, send_interval = %d, send_updates = %d, send_comments = %d,\n send_interval_visible = %d, send_updates_visible = %d, send_comments_visible = %d,\n autosub_on_post = %d, autosub_on_update = %d, autosub_on_comment = %d,\n send_self = %d\n WHERE uid = %d", $form_state['values']['digest'], $uid > 0 && $send_interval_visible == -2 ? -1 : $form_state['values']['send_interval'], $uid > 0 && $send_updates_visible == -2 ? -1 : $form_state['values']['send_updates'], $uid > 0 && $send_comments_visible == -2 ? -1 : $form_state['values']['send_comments'], $send_interval_visible, $send_updates_visible, $send_comments_visible, $form_state['values']['autosub_post'], $form_state['values']['autosub_update'], $form_state['values']['autosub_comment'], $form_state['values']['sendself'], $uid);
drupal_set_message(t('The changes have been saved.'));
}
}