By sun on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.x
Description:
In Drupal 7, Node module contained built-in API functions for determining the timestamp a registered user has last viewed a particular node. Comment module leveraged the node last viewed data to add "new" markers to new/unread comments.
This functionality has been moved into a separate History module (history.module), so as to decouple it from Node module and potentially make it available for other entity types.
Drupal 7
define('NODE_NEW_LIMIT', REQUEST_TIME - 30 * 24 * 60 * 60);
...
// Retrieve the timestamp at which the current user last viewed this node.
if (!$timestamp) {
$timestamp = node_last_viewed($nid);
}
...
// Update the history table, stating that this user viewed this node.
node_tag_new($node);
Drupal 8
define('HISTORY_READ_LIMIT', REQUEST_TIME - 30 * 24 * 60 * 60);
...
// Retrieve the timestamp at which the current user last viewed this node.
if (!$timestamp) {
$timestamp = history_read($nid);
}
...
// Update the history table, stating that this user viewed this node.
if (module_exists('history')) {
history_write($node->nid);
}
Impacts:
Module developers
Comments
Is the history_read function
Is the
history_readfunction in Core ?In the example you are embedding the
history_writefunction into amodule_existscondition but not thehistory_readone.Not a man. Empathy buddy & NVC trainee. Ally.