node_last_viewed

5 node.module node_last_viewed($nid)
6 node.module node_last_viewed($nid)
7 node.module node_last_viewed($nid)
8 node.module node_last_viewed($nid)

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

3 calls to node_last_viewed()

File

modules/node/node.module, line 179
The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.

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 = %d AND nid = %d", $user->uid, $nid));
  }

  return (isset($history[$nid]->timestamp) ? $history[$nid]->timestamp : 0);
}
Login or register to post comments