node_last_viewed
- Versions
- 4.6 – 7
node_last_viewed($nid)
Retrieves the timestamp at which the current user last viewed the specified node.
Code
modules/node.module, line 114
<?php
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 ($history[$nid]->timestamp ? $history[$nid]->timestamp : 0);
}
?>Login or register to post comments 