function _authcache_forum_topic_info in Authenticated User Page Caching (Authcache) 7
Same name and namespace in other branches
- 6 ajax/authcache.php \_authcache_forum_topic_info()
Number of new topic replies for user or topic is unread
See also
File
- ajax/
authcache.php, line 198 - Authcache Ajax Callback (authcache.php)
Code
function _authcache_forum_topic_info($vars) {
global $user;
$info = array();
drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH);
include_once './includes/common.inc';
include_once './includes/path.inc';
include_once './modules/field/field.module';
include_once './modules/node/node.module';
// Need NODE_NEW_LIMIT definition
include_once './modules/forum/forum.module';
include_once './modules/comment/comment.module';
foreach ($vars as $nid => $timestamp) {
$history = _forum_user_last_visit($nid);
$new_topics = (int) comment_num_new($nid, $history);
if ($new_topics) {
$info[$nid] = format_plural($new_topics, '1 new', '@count new');
}
elseif ($timestamp > $history) {
// unread
$info[$nid] = 1;
}
}
return $info;
}