You are here

function comment_controls_submit in Drupal 5

Same name and namespace in other branches
  1. 4 modules/comment.module \comment_controls_submit()
  2. 6 modules/comment/comment.module \comment_controls_submit()

File

modules/comment/comment.module, line 1755
Enables users to comment on published content.

Code

function comment_controls_submit($form_id, $form_values) {
  global $user;
  $mode = $form_values['mode'];
  $order = $form_values['order'];
  $comments_per_page = $form_values['comments_per_page'];
  if ($user->uid) {
    $user = user_save($user, array(
      'mode' => $mode,
      'sort' => $order,
      'comments_per_page' => $comments_per_page,
    ));
  }
  else {
    $_SESSION['comment_mode'] = $mode;
    $_SESSION['comment_sort'] = $order;
    $_SESSION['comment_comments_per_page'] = $comments_per_page;
  }
}