_forum_topics_unread
- Versions
- 4.7 – 7
_forum_topics_unread($term, $uid)
Calculate the number of nodes the user has not yet read and are newer than NODE_NEW_LIMIT.
Code
modules/forum/forum.module, line 717
<?php
function _forum_topics_unread($term, $uid) {
$query = db_select('node', 'n');
$query->join('forum', 'f', 'n.vid = f.vid AND f.tid = :tid', array(':tid' => $term));
$query->join('history', 'h', 'n.nid = h.nid AND h.uid = :uid', array(':uid' => $uid));
$query->addExpression('COUNT(n.nid)', 'count');
return $query
->condition('status', 1)
->condition('n.created', NODE_NEW_LIMIT, '>')
->isNull('h.nid')
->addTag('node_access')
->execute()
->fetchField();
}
?>Login or register to post comments 