function _authcache_node_history in Authenticated User Page Caching (Authcache) 7
Same name and namespace in other branches
- 6 ajax/authcache.php \_authcache_node_history()
Node history
See also
File
- ajax/
authcache.php, line 125 - Authcache Ajax Callback (authcache.php)
Code
function _authcache_node_history($nid) {
global $user;
include_once './modules/node/node.module';
// Update the 'last viewed' timestamp of the specified node for current user.
// We do not want to use node_tag_view here because it requires a node_load
// which seems impossible when drupal is not fully bootstraped. The following
// code is directly copied from node_tag_view.
if ($user->uid) {
db_merge('history')
->key(array(
'uid' => $user->uid,
'nid' => $nid,
))
->fields(array(
'timestamp' => REQUEST_TIME,
))
->execute();
}
// Retrieves the timestamp at which the current user last viewed the specified node
return node_last_viewed($nid);
}