function _discussthis_comment_num_all in Discuss This! 7.2
Same name and namespace in other branches
- 7 discussthis.node.inc \_discussthis_comment_num_all()
Find the number of comments for a node.
Parameters
$nid the id of the node to retrieve comment count for.:
Return value
integer the comment count.
1 call to _discussthis_comment_num_all()
- discussthis_field_formatter_view in ./
discussthis.fields.inc - Implements hook_field_formatter_view().
File
- ./
discussthis.node.inc, line 158 - File with node discussion display methods.
Code
function _discussthis_comment_num_all($nid) {
static $cache;
if (!isset($cache[$nid])) {
$cache[$nid] = db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = :nid', array(
':nid' => $nid,
))
->fetchField();
}
return $cache[$nid];
}