function history_read

Same name in other branches
  1. 8.9.x core/modules/history/history.module \history_read()
  2. 10 core/modules/history/history.module \history_read()
  3. 11.x 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
Builds links for the given entity.
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 50

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.