Same name and namespace in other branches
  1. 4.6.x modules/comment.module \comment_num_all()
  2. 4.7.x modules/comment.module \comment_num_all()
  3. 5.x modules/comment/comment.module \comment_num_all()

Get comment count for a node.

Parameters

$nid: The node id.

Return value

The comment count.

1 call to comment_num_all()
comment_link in modules/comment/comment.module
Implementation of hook_link().

File

modules/comment/comment.module, line 1117
Enables users to comment on published content.

Code

function comment_num_all($nid) {
  static $cache;
  if (!isset($cache[$nid])) {
    $cache[$nid] = db_result(db_query('SELECT comment_count FROM {node_comment_statistics} WHERE nid = %d', $nid));
  }
  return $cache[$nid];
}