function cleantalk_comment_delete in Anti Spam by CleanTalk 7.2
Same name and namespace in other branches
- 8 cleantalk.module \cleantalk_comment_delete()
- 7 cleantalk.module \cleantalk_comment_delete()
Implements hook_comment_delete().
File
- ./
cleantalk.module, line 1703 - Main CleanTalk integration module functions.
Code
function cleantalk_comment_delete($comment) {
$result = db_select('cleantalk_cids', 'c')
->fields('c', array(
'ct_request_id',
'ct_result_comment',
))
->condition('cid', $comment->cid, '=')
->range(0, 1)
->execute();
if ($result
->rowCount() > 0) {
$ct_result = $result
->fetchObject();
// If ct_result_comment is empty then comment is approved by server.
// But we delete it then comment is not approved by admin.
// We need to send negative feedback.
_cleantalk_send_feedback($ct_result->ct_request_id, 0);
db_delete('cleantalk_cids')
->condition('cid', $comment->cid, '=')
->execute();
}
}