node_mark

modules/node/node.module, line 121

Versions
4.6 – 7
node_mark($nid, $timestamp)

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.

▾ 3 functions call node_mark()

node_admin_nodes in modules/node/node.module
theme_comment_view in modules/comment/comment.module
tracker_page in modules/tracker/tracker.module
Menu callback. Prints a listing of active nodes on the site.

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.