function authcache_preprocess_forum_topic_list in Authenticated User Page Caching (Authcache) 7
Same name and namespace in other branches
- 6 authcache.module \authcache_preprocess_forum_topic_list()
Process forum template variables
Remove "new" marker
See also
File
- ./
authcache.module, line 661 - Authenticated User Page Caching (and anonymous users, too!)
Code
function authcache_preprocess_forum_topic_list(&$variables) {
if ($variables['authcache_is_cacheable'] === true) {
if (!empty($variables['topics'])) {
foreach ($variables['topics'] as $id => $topic) {
$nid = $variables['topics'][$id]->nid;
// Replace "new" icons. If you are using custom icons, make sure
// the filenames have the same format as Drupal core
$icon = str_replace('hot-new', 'hot', $variables['topics'][$id]->icon);
$icon = str_replace('new', 'default', $variables['topics'][$id]->icon);
$variables['topics'][$id]->icon = '<span class="authcache-topic-icon" data-nid="' . $nid . '">' . $icon . '</span>';
$variables['topics'][$id]->title .= '<span class="authcache-topic-info" data-timestamp="' . $variables['topics'][$id]->last_comment_timestamp . '" data-nid="' . $nid . '"></span>';
// "New" reply count will be handle via Ajax
if ($topic->comment_count) {
$variables['topics'][$id]->comment_count .= '<span class="authcache-topic-replies" data-nid="' . $nid . '"></span>';
$variables['topics'][$id]->new_text = '';
$variables['topics'][$id]->new_url = '';
}
}
}
}
}