node_last_viewed
Definition
node_last_viewed($nid)
modules/node/node.module, line 173
Description
Retrieves the timestamp at which the current user last viewed the specified node.
Code
<?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 = %d AND nid = %d", $user->uid, $nid));
}
return (isset($history[$nid]->timestamp) ? $history[$nid]->timestamp : 0);
}
?> 