Display categories that have updated or new nodes since user last logged in.

For my front page I show the categories that have new and / or updated nodes.
This in combination with taxonomy context and taxonomy image shows the terms pretty nicely.

<?php
global $user;
$sql = db_rewrite_sql('SELECT distinct tn.tid FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid LEFT JOIN {history} h on h.nid = n.nid RIGHT JOIN {users} u on h.uid = u.uid WHERE u.uid = %d AND (h.timestamp < n.changed OR h.timestamp is null) ORDER BY h.timestamp');
$sql = db_rewrite_sql($sql,'tn','tid');
$result = db_query($sql,$user->uid);
if(
db_num_rows($result)){
 
$output = '<div class="homepage"><h2 class="title">Categories with new or updated content</h2>';
  while (
$term = db_fetch_object($result)) {
   
$term = taxonomy_get_term($term->tid);
   
$output .= theme('taxonomy_context_term', $term, 'subterm');
  }
 
$output .= '</div>';
} else {
 
$output = '<div class="homepage">No new or updated content.</div>';
}
echo
$output;
?>

Works for me in 5.x

majnoona - May 10, 2007 - 14:05

Neat tool... I bet it could be combined with the community_tag module to allow any user to categories content.

Thanks

 
 

Drupal is a registered trademark of Dries Buytaert.