Looking to see that after you use Last Node, the next time you use it, could it ONLY display items that were changed since your last visit?

Comments

TheCrow’s picture

Assigned: Unassigned » TheCrow

Into last_node.module, function lastnode_display :
Substitute this line:

...
$result = db_query_range("SELECT n.title, n.nid, n.created FROM {node} n WHERE n.status = 1 AND n.type = '%s' ORDER BY n.created DESC", $node_type, 0, $numitem);
...

with:

  ...
  global $user;

  if ($u = (int) $user->uid > 0) {
  $result = db_query_range("SELECT n.title, n.nid, n.created, h.timestamp, n.changed FROM {node} n LEFT JOIN history h ON n.nid = h.nid AND h.uid = %d WHERE n.status =1 AND n.type = '%s' AND (h.timestamp IS NULL OR h.timestamp < n.changed) ORDER BY n.created DESC", $user->uid ,$node_type, 0, $numitem);
 }
 else {
  $result = db_query_range("SELECT n.title, n.nid, n.created FROM {node} n WHERE n.status = 1 AND n.type = '%s' ORDER BY n.created DESC", $node_type, 0, $numitem);
  }
  ...

AND in the same file, function _last_node_page:

this line:

  ...
  $result = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = '%s' AND n.status = 1 ORDER BY n.created DESC"), variable_get('default_nodes_main', 10), 0, NULL, $type);
  ...

with:

...
  global $user;

  if ($u = (int) $user->uid > 0) {
    $result = pager_query(db_rewrite_sql("SELECT n.title, n.nid, n.created, h.timestamp, n.changed FROM {node} n LEFT JOIN history h ON n.nid = h.nid AND h.uid = %d WHERE n.status =1 AND n.type = '%s' AND (h.timestamp IS NULL OR h.timestamp < n.changed) ORDER BY n.created DESC"), variable_get('default_nodes_main', 10), 0, NULL, $user->uid, $type);
  }
  else {
    $result = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = '%s' AND n.status = 1 ORDER BY n.created DESC"), variable_get('default_nodes_main', 10), 0, NULL, $type);
  }
...

P.S. : put the whole query string in the same line