You are here

function history_read in Drupal 10

Same name and namespace in other branches
  1. 8 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
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 50
Records which users have read which content.

Code

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