Community Documentation

node_tag_new

5 node.module node_tag_new($nid)
6 node.module node_tag_new($nid)
7 node.module node_tag_new($node)
8 node.module node_tag_new($node)

Update the 'last viewed' timestamp of the specified node for current user.

▾ 1 function calls node_tag_new()

node_show in modules/node/node.module
Generate a page displaying a single node, along with its comments.

File

modules/node/node.module, line 162
The core that allows content to be submitted to the site. Modules and scripts may programmatically submit nodes using the usual form API pattern.

Code

<?php
function node_tag_new($nid) {
  global $user;

  if ($user->uid) {
    if (node_last_viewed($nid)) {
      db_query('UPDATE {history} SET timestamp = %d WHERE uid = %d AND nid = %d', time(), $user->uid, $nid);
    }
    else {
      @db_query('INSERT INTO {history} (uid, nid, timestamp) VALUES (%d, %d, %d)', $user->uid, $nid, time());
    }
  }
}
?>

Comments

a pair

this function can be used as test pair with:
node_last_viewed($nid);

Login or register to post comments