Same name and namespace in other branches
  1. 4.7.x modules/forum.module \_forum_topics_unread()
  2. 5.x modules/forum/forum.module \_forum_topics_unread()
  3. 7.x 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()
template_preprocess_forum_list in modules/forum/forum.module
Process variables to format a forum listing.

File

modules/forum/forum.module, line 567
Enable threaded discussions about general topics.

Code

function _forum_topics_unread($term, $uid) {
  $sql = "SELECT COUNT(DISTINCT n.nid) FROM {node} n INNER JOIN {term_node} tn ON n.vid = tn.vid AND tn.tid = %d LEFT JOIN {history} h ON n.nid = h.nid AND h.uid = %d WHERE n.status = 1 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));
}