function comment_admin_overview_submit

7.x comment.admin.inc comment_admin_overview_submit($form, &$form_state)
6.x comment.admin.inc comment_admin_overview_submit($form, &$form_state)

Process comment_admin_overview form submissions.

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

File

drupal-6.x/modules/comment/comment.admin.inc, line 95
Admin page callbacks for the comment module.

Code

function comment_admin_overview_submit($form, &$form_state) {
  $operations = comment_operations();
  if (!empty($operations[$form_state['values']['operation']][1])) {
    // extract the appropriate database query operation
    $query = $operations[$form_state['values']['operation']][1];
    foreach ($form_state['values']['comments'] as $cid => $value) {
      if ($value) {
        // perform the update action, then refresh node statistics
        db_query($query, $cid);
        $comment = _comment_load($cid);
        _comment_update_node_statistics($comment->nid);
        // Allow modules to respond to the updating of a comment.
        comment_invoke_comment($comment, $form_state['values']['operation']);
        // Add an entry to the watchdog log.
        watchdog('content', 'Comment: updated %subject.', array('%subject' => $comment->subject), WATCHDOG_NOTICE, l(t('view'), 'node/' . $comment->nid, array('fragment' => 'comment-' . $comment->cid)));
      }
    }
    cache_clear_all();
    drupal_set_message(t('The update has been performed.'));
    $form_state['redirect'] = 'admin/content/comment';
  }
}