function node_mark

Determines the type of marker to be displayed for a given node.

Parameters

$nid: Node ID whose history supplies the "last viewed" timestamp.

$timestamp: Time which is compared against node's "last viewed" timestamp.

Return value

One of the MARK constants.

4 calls to node_mark()
FieldNewValue::getValue in drupal/core/modules/comment/lib/Drupal/comment/FieldNewValue.php
Implements \Drupal\Core\TypedData\TypedDataInterface::getValue().
node_admin_nodes in drupal/core/modules/node/node.admin.inc
Returns the admin form object to node_admin_content().
theme_node_recent_content in drupal/core/modules/node/node.module
Returns HTML for a recent node to be displayed in the recent content block.
tracker_page in drupal/core/modules/tracker/tracker.pages.inc
Page callback: Generates a page of tracked nodes for the site.

File

drupal/core/modules/node/node.module, line 285
The core module that allows content to be submitted to the site.

Code

function node_mark($nid, $timestamp) {
  global $user;
  $cache =& drupal_static(__FUNCTION__, array());
  if (!$user->uid || !module_exists('history')) {
    return MARK_READ;
  }
  if (!isset($cache[$nid])) {
    $cache[$nid] = history_read($nid);
  }
  if ($cache[$nid] == 0 && $timestamp > HISTORY_READ_LIMIT) {
    return MARK_NEW;
  }
  elseif ($timestamp > $cache[$nid] && $timestamp > HISTORY_READ_LIMIT) {
    return MARK_UPDATED;
  }
  return MARK_READ;
}