Form submission handler for comment_admin_overview().
Executes the chosen 'Update option' on the selected comments, such as publishing, unpublishing or deleting.
comment_admin_overview_validate()
function comment_admin_overview_submit($form, &$form_state) {
$operation = $form_state['values']['operation'];
$cids = $form_state['values']['comments'];
if ($operation == 'delete') {
entity_delete_multiple('comment', $cids);
}
else {
foreach ($cids as $cid => $value) {
$comment = comment_load($value);
if ($operation == 'unpublish') {
$comment->status->value = COMMENT_NOT_PUBLISHED;
}
elseif ($operation == 'publish') {
$comment->status->value = COMMENT_PUBLISHED;
}
$comment
->save();
}
}
drupal_set_message(t('The update has been performed.'));
$form_state['redirect'] = 'admin/content/comment';
cache_invalidate_tags(array(
'content' => TRUE,
));
}