Tracker Module Hack

I wanted to exclude certain content types for the recent posts page when it was called without specifically tracking a user. To this end I modified tracker.module by searching for the tracker_page() function and changing the $sql statement in the conditional.


<?php
/* CHANGED QUERY TO EXCLUDE CATEGORIES AND CONTAINERS IF NO UID SELECTED ... */
  
if ($uid) {
    
//~ STUFF
  
}
  else { 
//~ CHANGED to filter by content type when UID
    
$sql  'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, ';
    
$sql .= 'GREATEST(n.changed, l.last_comment_timestamp) AS last_updated, l.comment_count ';
    
$sql .= 'FROM {node} n INNER JOIN {users} u ON n.uid = u.uid ';
    
$sql .= 'INNER JOIN {node_comment_statistics} l ON n.nid = l.nid ';
    
$sql .= 'WHERE n.status = 1 AND n.type NOT IN (\'category_cat\', \'category_cont\') '
    
$sql .= 'ORDER BY last_updated DESC';
    
$sql db_rewrite_sql($sql);
    
$sql_count 'SELECT COUNT(n.nid) FROM {node} n WHERE n.status = 1 ';
    
$sql_count .= 'AND n.type NOT IN (\'category_cat\', \'category_cont\')';
    
$sql_count db_rewrite_sql($sql_count);
    
$result pager_query($sql250$sql_count);
  }



The tracker results now show all not category or container updates.

Comments

Fixed a little bug

I added the NOT IN condition to the $sql_count query too:
previously it caused the pager_query to return more pages than there should have been.

Of course you can add this condition for the first part of the conditional too
if you do not want logged in users to see the blocked content (categories in this case).

Br

Jamie

Unraveling the mysteries of the web
http://www.skiffie.com

Syndicate content