You are here

function comment_og_form_submit in Comment OG 6

Modified version of comment_form_submit() used for editing by group administrators

File

./comment_og.module, line 366

Code

function comment_og_form_submit($form, &$form_state) {
  _comment_form_submit($form_state['values']);
  global $user;

  // We assume that the acting user isn't the original comment author, so we add
  // the edit message to the end of the unfiltered message.
  $form_state['values']['comment'] .= comment_og_admin_edit_msg($user);
  if ($cid = comment_save($form_state['values'])) {
    $node = node_load($form_state['values']['nid']);

    // Add 1 to existing $node->comment count to include new comment being added.
    $comment_count = $node->comment_count + 1;
    $page = comment_new_page_count($comment_count, 1, $node);
    $form_state['redirect'] = array(
      'node/' . $node->nid,
      $page,
      "comment-{$cid}",
    );
    return;
  }
}