function comment_controls_submit in Drupal 6
Same name and namespace in other branches
- 4 modules/comment.module \comment_controls_submit()
- 5 modules/comment/comment.module \comment_controls_submit()
Process comment_controls form submissions.
File
- modules/
comment/ comment.module, line 1657 - Enables users to comment on published content.
Code
function comment_controls_submit($form, &$form_state) {
global $user;
$mode = $form_state['values']['mode'];
$order = $form_state['values']['order'];
$comments_per_page = $form_state['values']['comments_per_page'];
if ($user->uid) {
$account = user_save($user, array(
'mode' => $mode,
'sort' => $order,
'comments_per_page' => $comments_per_page,
));
// Terminate if an error occured during user_save().
if (!$account) {
drupal_set_message(t("Error saving user account."), 'error');
return;
}
$user = $account;
}
else {
$_SESSION['comment_mode'] = $mode;
$_SESSION['comment_sort'] = $order;
$_SESSION['comment_comments_per_page'] = $comments_per_page;
}
}