function advanced_forum_statistics_replies in Advanced Forum 7.2
Same name and namespace in other branches
- 6.2 advanced_forum.module \advanced_forum_statistics_replies()
Counts total amount of replies.
Initial posts are added to this total in the calling function.
Parameters
int|null $delta: if not NULL, a numerical delta which should be applied to the count
bool $refresh: TRUE if the stored count should be updated.
Return value
int Total number of replies in the forum.
5 calls to advanced_forum_statistics_replies()
- advanced_forum_comment_delete in ./
advanced_forum.module - Implements hook_comment_delete().
- advanced_forum_comment_publish in ./
advanced_forum.module - Implements hook_comment_publish().
- advanced_forum_comment_update in ./
advanced_forum.module - Implements hook_comment_update().
- advanced_forum_cron in ./
advanced_forum.module - Implements hook_cron().
- advanced_forum_preprocess_advanced_forum_statistics in includes/
theme.inc - Preprocesses template variables for the forum statistics template.
File
- ./
advanced_forum.module, line 764 - Enables the look and feel of other popular forum software.
Code
function advanced_forum_statistics_replies($delta = NULL, $refresh = FALSE) {
if ($refresh || !($cache = cache_get('advanced_forum_stats_replies'))) {
$total_replies = db_query('SELECT SUM(comment_count) FROM {forum_index}')
->fetchField();
cache_set('advanced_forum_stats_replies', $total_replies);
}
else {
$total_replies = $cache->data;
}
if (!empty($delta) && is_numeric($delta)) {
$total_replies += $delta;
cache_set('advanced_forum_stats_replies', $total_replies);
}
return $total_replies;
}