node_mark

Definition

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

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;
}
?>
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.