comment_num_replies

Versions
4.6 – 7
comment_num_replies($pid)

Get replies count for a comment.

Parameters

$pid The comment id.

Return value

The replies count.

▾ 1 function calls comment_num_replies()

comment_access in modules/comment/comment.module
This is *not* a hook_access() implementation. This function is called to determine whether the current user has access to a particular comment.

Code

modules/comment/comment.module, line 1533

<?php
function comment_num_replies($pid) {
  $cache = &drupal_static(__FUNCTION__, array());

  if (!isset($cache[$pid])) {
    $cache[$pid] = db_query('SELECT COUNT(cid) FROM {comment} WHERE pid = :pid AND status = :status', array(
      ':pid' => $pid,
      ':status' => COMMENT_PUBLISHED,
    ))->fetchField();
  }

  return $cache[$pid];
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.