You are here

function _authcache_forum_topic_new in Authenticated User Page Caching (Authcache) 6

Same name and namespace in other branches
  1. 7 ajax/authcache.php \_authcache_forum_topic_new()

Number of new forum topics for user

See also

forum.module

File

ajax/authcache.php, line 153
Authcache Ajax Callback (authcache.php)

Code

function _authcache_forum_topic_new($vars) {
  global $user;
  $new = array();
  drupal_bootstrap(DRUPAL_BOOTSTRAP_PATH);
  include_once './modules/node/node.module';

  // Need NODE_NEW_LIMIT definition
  include_once './modules/forum/forum.module';
  include_once './modules/filter/filter.module';

  // XSS filter for l()
  foreach ($vars as $tid) {
    $new_topics = (int) _forum_topics_unread($tid, $user->uid);
    if ($new_topics) {
      $new[$tid] = l(format_plural($new_topics, '1 new', '@count new'), "forum/{$tid}", array(
        'fragment' => 'new',
      ));
    }
  }
  return $new;
}