function reviews_reviews_count in Reviews 7
Get review count.
Helper function to return the number of approved reviews for the current node.
2 calls to reviews_reviews_count()
- reviews_get_reviews in includes/
reviews.pages.inc - Gather reviews for current displayed node and pass to theming function.
- reviews_get_title in includes/
reviews.api.inc - Title callback function.
File
- includes/
reviews.api.inc, line 52 - This file contains API functions for the reviews system.
Code
function reviews_reviews_count($nid) {
$results = db_select('reviews', 'r')
->fields('r')
->condition('nid', $nid, '=')
->condition('status', 1, '=')
->execute()
->fetchAll();
return count($results);
}