1 comment.admin.inc comment_admin_overview_submit($form, &$form_state)

Form submission handler for comment_admin_overview().

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

See also

comment_admin_overview_validate()

File

core/modules/comment/comment.admin.inc, line 180
Admin page callbacks for the Comment module.

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);
  }
  else {
    foreach ($cids as $cid => $value) {
      $comment = comment_load($value);

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