Same name and namespace in other branches
  1. 4.6.x modules/node.module \node_last_viewed()
  2. 5.x modules/node/node.module \node_last_viewed()
  3. 6.x modules/node/node.module \node_last_viewed()
  4. 7.x modules/node/node.module \node_last_viewed()

Retrieves the timestamp at which the current user last viewed the specified node.

2 calls to node_last_viewed()
comment_num_new in modules/comment.module
get number of new comments for current user and specified node
node_mark in modules/node.module
Decide on the type of marker to be displayed for a given node.

File

modules/node.module, line 107
The core that allows content to be submitted to the site.

Code

function node_last_viewed($nid) {
  global $user;
  static $history;
  if (!isset($history[$nid])) {
    $history[$nid] = db_fetch_object(db_query("SELECT timestamp FROM {history} WHERE uid = '{$user->uid}' AND nid = %d", $nid));
  }
  return isset($history[$nid]->timestamp) ? $history[$nid]->timestamp : 0;
}