function _forum_topics_unread in Drupal 5
Same name and namespace in other branches
- 4 modules/forum.module \_forum_topics_unread()
- 6 modules/forum/forum.module \_forum_topics_unread()
- 7 modules/forum/forum.module \_forum_topics_unread()
Calculate the number of nodes the user has not yet read and are newer than NODE_NEW_LIMIT.
1 call to _forum_topics_unread()
- theme_forum_list in modules/
forum/ forum.module - Format the forum listing.
File
- modules/
forum/ forum.module, line 753 - Enable threaded discussions about general topics.
Code
function _forum_topics_unread($term, $uid) {
$sql = "SELECT COUNT(n.nid) FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid AND tn.tid = %d LEFT JOIN {history} h ON n.nid = h.nid AND h.uid = %d WHERE n.status = 1 AND n.type = 'forum' AND n.created > %d AND h.nid IS NULL";
$sql = db_rewrite_sql($sql);
return db_result(db_query($sql, $term, $uid, NODE_NEW_LIMIT));
}