You are here

function _discussthis_comment_num_all in Discuss This! 7

Same name and namespace in other branches
  1. 7.2 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_node_view in ./discussthis.node.inc
Implements hook_node_view().

File

./discussthis.node.inc, line 330
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];
}