You are here

function comment_delete_options_form_submit in Comment Delete 7

Submission handler for comment deletion form.

File

./comment_delete.module, line 171
comment_delete.module

Code

function comment_delete_options_form_submit($form, $form_state) {
  $comment = $form_state['storage']['comment'];

  // Perform selected comment delete action.
  switch ($form_state['values']['action']) {

    // Delete comment and replies.
    case 0:
      comment_delete_remove_replies($comment);
      break;

    // Delete comment and move replies.
    case 1:
      comment_delete_move_replies($comment);
      break;

    // Delete comment and keep replies.
    case 2:
      comment_delete_keep_replies($comment);
      break;
  }

  // Display success message and redirect if destination not set.
  if ($message = variable_get('comment_delete_message', '')) {
    drupal_set_message(t($message));
  }
  if (!isset($_GET['destination'])) {
    drupal_goto('node/' . $comment->nid);
  }
}