node_last_viewed

  1. drupal
    1. drupal6
    2. drupal7
Versionen
drupal6 – drupal7 node_last_viewed($nid)

Retrieves the timestamp at which the current user last viewed the specified node.

▾ 3 functions call node_last_viewed()

comment_num_new in modules/comment/comment.module
Get number of new comments for current user and specified node.
node_mark in modules/node/node.module
Decide on the type of marker to be displayed for a given node.
node_tag_new in modules/node/node.module
Update the 'last viewed' timestamp of the specified node for current user.

Code

modules/node/node.module, line 180

<?php
function node_last_viewed($nid) {
  global $user;
  static $history;

  if (!isset($history[$nid])) {
    $history[$nid] = db_fetch_object(db_query("SELECT timestamp FROM {history} WHERE uid = %d AND nid = %d", $user->uid, $nid));
  }

  return (isset($history[$nid]->timestamp) ? $history[$nid]->timestamp : 0);
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen