comment_admin_overview_submit

Versions
4.7
comment_admin_overview_submit($form_id, $edit)
5
comment_admin_overview_submit($form_id, $form_values)
6 – 7
comment_admin_overview_submit($form, &$form_state)

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

Code

modules/comment.module, line 998

<?php
function comment_admin_overview_submit($form_id, $edit) {
  $operations = comment_operations();
  if ($operations[$edit['operation']][1]) {
    // extract the appropriate database query operation
    $query = $operations[$edit['operation']][1];
    foreach ($edit['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, $edit['operation']);
        // Add an entry to the watchdog log.
        watchdog('content', t('Comment: updated %subject.', array('%subject' => theme('placeholder', $comment->subject))), WATCHDOG_NOTICE, l(t('view'), 'node/'. $comment->nid, NULL, NULL, 'comment-'. $comment->cid));
      }
    }
    cache_clear_all();
    drupal_set_message(t('The update has been performed.'));
    drupal_goto('admin/comment');
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.