function cleantalk_comment_insert in Anti Spam by CleanTalk 8
Same name and namespace in other branches
- 7 cleantalk.module \cleantalk_comment_insert()
- 7.2 cleantalk.module \cleantalk_comment_insert()
Implements hook_comment_insert().
File
- ./
cleantalk.module, line 446 - Main CleanTalk integration module functions.
Code
function cleantalk_comment_insert(\Drupal\comment\CommentInterface $comment) {
$ct_result = _cleantalk_ct_result();
if (!empty($ct_result['ct_request_id'])) {
// Values of request_id and comment are stored in globals.
// Store them in DB now.
db_insert('cleantalk_cids')
->fields(array(
'cid' => $comment
->id(),
'ct_request_id' => $ct_result['ct_request_id'],
'ct_result_comment' => empty($ct_result['ct_result_comment']) ? '' : $ct_result['ct_result_comment'],
))
->execute();
_cleantalk_ct_result('set');
}
}