Updates 'last viewed' timestamp of the specified entity for the current user.
$nid: The node ID that has been read.
$account: (optional) The user account to update the history for. Defaults to the current user.
function history_write($nid, $account = NULL) {
global $user;
if (!isset($account)) {
$account = $user;
}
if ($account->uid) {
db_merge('history')
->key(array(
'uid' => $account->uid,
'nid' => $nid,
))
->fields(array(
'timestamp' => REQUEST_TIME,
))
->execute();
}
}