function cleantalk_check_comments_form_submit in Anti Spam by CleanTalk 7.5
Same name and namespace in other branches
- 7.4 src/Form/CleantalkCheckCommentsForm.php \cleantalk_check_comments_form_submit()
File
- src/
Form/ CleantalkCheckCommentsForm.php, line 107 - CleanTalk module admin functions.
Code
function cleantalk_check_comments_form_submit($form, &$form_state) {
$action = $form_state['values']['cleantalk_spam_comments_wrapper']['cleantalk_spam_comments_table_actions'];
$values = array();
foreach ($form_state['values']['cleantalk_spam_comments_wrapper']['cleantalk_spam_comments_table'] as $key => $value) {
if (is_string($value)) {
$values[] = $form_state['complete form']['cleantalk_spam_comments']['cleantalk_spam_comments_wrapper']['cleantalk_spam_comments_table']['#options'][$value];
}
}
//Delete comment
if ($action == 1) {
foreach ($values as $comment) {
comment_delete($comment['#attributes']['comment_id']);
}
}
}