node_mark

Definition

node_mark($nid, $timestamp)
node/node.module, line 121

Description

Decide on 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.

Code

<?php
function node_mark($nid, $timestamp) {
  global $user;
  static $cache;

  if (!$user->uid) {
    return MARK_READ;
  }
  if (!isset($cache[$nid])) {
    $cache[$nid] = node_last_viewed($nid);
  }
  if ($cache[$nid] == 0 && $timestamp > NODE_NEW_LIMIT) {
    return MARK_NEW;
  }
  elseif ($timestamp > $cache[$nid] && $timestamp > NODE_NEW_LIMIT) {
    return MARK_UPDATED;
  }
  return MARK_READ;
}
?>