function 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

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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.