function ForumManager::unreadTopics
Same name in other branches
- 8.9.x core/modules/forum/src/ForumManager.php \Drupal\forum\ForumManager::unreadTopics()
- 10 core/modules/forum/src/ForumManager.php \Drupal\forum\ForumManager::unreadTopics()
- 11.x core/modules/forum/src/ForumManager.php \Drupal\forum\ForumManager::unreadTopics()
Overrides ForumManagerInterface::unreadTopics
File
-
core/
modules/ forum/ src/ ForumManager.php, line 482
Class
- ForumManager
- Provides forum manager service.
Namespace
Drupal\forumCode
public function unreadTopics($term, $uid) {
$query = $this->connection
->select('node_field_data', 'n');
$query->join('forum', 'f', '[n].[vid] = [f].[vid] AND [f].[tid] = :tid', [
':tid' => $term,
]);
$query->leftJoin('history', 'h', '[n].[nid] = [h].[nid] AND [h].[uid] = :uid', [
':uid' => $uid,
]);
$query->addExpression('COUNT([n].[nid])', 'count');
return $query->condition('status', 1)
->condition('n.default_langcode', 1)
->condition('n.created', HISTORY_READ_LIMIT, '>')
->isNull('h.nid')
->addTag('node_access')
->execute()
->fetchField();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.