Same name and namespace in other branches
  1. 8.9.x core/modules/history/history.module \history_read()
  2. 9 core/modules/history/history.module \history_read()

Retrieves the timestamp for the current user's last view of a specified node.

Parameters

int $nid: A node ID.

Return value

int If a node has been previously viewed by the user, the timestamp in seconds of when the last view occurred; otherwise, zero.

5 calls to history_read()
CommentLinkBuilder::buildCommentedEntityLinks in core/modules/comment/src/CommentLinkBuilder.php
CommentManager::getCountNewComments in core/modules/comment/src/CommentManager.php
Returns the number of new comments available on a given entity for a user.
HistoryController::readNode in core/modules/history/src/Controller/HistoryController.php
Marks a node as read by the current user right now.
HistoryRenderCallback::lazyBuilder in core/modules/history/src/HistoryRenderCallback.php
#lazy_builder callback; attaches the last read timestamp for a node.
node_mark in core/modules/node/node.module
Determines the type of marker to be displayed for a given node.
1 string reference to 'history_read'
CommentLinkBuilderTest.php in core/modules/comment/tests/src/Unit/CommentLinkBuilderTest.php

File

core/modules/history/history.module, line 49
Records which users have read which content.

Code

function history_read($nid) {
  $history = history_read_multiple([
    $nid,
  ]);
  return $history[$nid];
}