comment_form_submit

function comment_form_submit

comment_form_submit($form, &$form_state)

Process comment form submissions; prepare the comment, store it, and set a redirection target.

File

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

Code

function comment_form_submit($form, &$form_state) {
  $node = node_load($form_state['values']['nid']);
  $comment = comment_form_submit_build_comment($form, $form_state);
  if (user_access('post comments') && (user_access('administer comments') || $node->comment == COMMENT_NODE_OPEN)) {
    // Save the anonymous user information to a cookie for reuse.
    if (user_is_anonymous()) {
      user_cookie_save(array_intersect_key($form_state['values'], array_flip(array('name', 'mail', 'homepage