_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 547

<?php
function _forum_topics_unread($term, $uid) {
  $sql = "SELECT COUNT(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));
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.