You are here

function comment_admin_overview_submit in Drupal 7

Same name and namespace in other branches
  1. 4 modules/comment.module \comment_admin_overview_submit()
  2. 5 modules/comment/comment.module \comment_admin_overview_submit()
  3. 6 modules/comment/comment.admin.inc \comment_admin_overview_submit()

Process comment_admin_overview form submissions.

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

File

modules/comment/comment.admin.inc, line 160
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);
    }
  }
  drupal_set_message(t('The update has been performed.'));
  $form_state['redirect'] = 'admin/content/comment';
  cache_clear_all();
}