comment_admin_overview_submit

Definition

comment_admin_overview_submit($form, &$form_state)
drupal/modules/comment/comment.admin.inc, line 158

Description

Process comment_admin_overview form submissions.

Execute the chosen 'Update option' on the selected comments, such as publishing, unpublishing or deleting.

Code

function comment_admin_overview_submit($form, &$form_state) {
  $operation = $form_state['values']['operation'];
  $cids = $form_state['values']['comments'];

  if ($operation == 'delete') {
    comment_delete_multiple($cids);
    cache_clear_all();
  }
  else {
    foreach ($cids as $cid => $value) {
      $comment = comment_load($value);

      if ($operation == 'unpublish') {
        $comment->status = COMMENT_NOT_PUBLISHED;
      }
      else if ($operation == 'publish') {
        $comment->status = COMMENT_PUBLISHED;
      }
      comment_save($comment);
    }
  }
  drupal_set_message(t('The update has been performed.'));
  $form_state['redirect'] = 'admin/content/comment';
}