function cleantalk_comment_view_alter in Anti Spam by CleanTalk 7
Same name and namespace in other branches
- 7.2 cleantalk.module \cleantalk_comment_view_alter()
Implements hook_comment_view_alter().
File
- ./
cleantalk.module, line 1469 - Main CleanTalk integration module functions.
Code
function cleantalk_comment_view_alter(&$build) {
if (user_access('administer comments')) {
$result = db_select('cleantalk_cids', 'c')
->fields('c', array(
'ct_request_id',
'ct_result_comment',
))
->condition('cid', $build['#comment']->cid, '=')
->range(0, 1)
->execute();
if ($result
->rowCount() > 0) {
$ct_result = $result
->fetchObject();
if (!empty($ct_result->ct_result_comment)) {
// Value of ct_result_comment is sanitized already (before storing).
$build['comment_body'][0]['#markup'] .= '<hr>' . $ct_result->ct_result_comment;
}
}
}
}