This patch adds a recents posts/nodes/comments block to tracker.module.

It is better than the 'recent comments' block in comment.module in my opinion: this block includes recent nodes/images/events/etc. as well, and it uses less space.

The patch is for 4.5.2, but I guess it would work with few adjustments (if any) on 4.6.x.

CommentFileSizeAuthor
tracker.module.recent.posts.block.patch1.59 KBhba
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Dublin Drupaller’s picture

Heisen...

Great patch...works perfectly.

Just curious if you know how to restrict the output to just list recent forum posts & comments...as opposed to listing all types of nodes.

Takk skal du har!

Dub

Dublin Drupaller’s picture

..worked that out for myself...the following snippet creates a list of recent forum topics and active forum topics...

Can be used in a drupal page or block (with the filter set to PHP)

<?php
$content  = node_title_list(db_query_range("SELECT DISTINCT(n.nid), n.title, l.last_comment_timestamp FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid ". node_access_join_sql() ." WHERE n.status = 1 AND n.type='forum' AND ". node_access_where_sql() ." ORDER BY l.last_comment_timestamp DESC", 0, variable_get('forum_block_num', '5')), t('Active forum topics:'));

      $content .= node_title_list(db_query_range("SELECT DISTINCT(n.nid), n.title FROM {node} n ". node_access_join_sql() ." WHERE n.type = 'forum' AND n.status = 1 AND ". node_access_where_sql() ." ORDER BY n.nid DESC", 0, variable_get('forum_block_num', '5')), t('New forum topics:'));

      if ($content) {
        $content .= '<div class="more-link">'. l(t('more'), 'forum', array('title' => t('Read the latest forum topics.'))) .'</div>';
      }

print $content;

?>

I'm trying to get the tracker_page function SQL query to filter out by n.type='forum' ..but I'm not sure how to do that....can you help by any chance?

here's a thread on that specific topic...

http://drupal.org/node/22881

Cheers

Dub

Dries’s picture

No working patch attached. The patch dates back from 4.5.2.

Andrzej7’s picture

Trying to configure the block, I get the message:

Fatal error: Call to undefined function: node_access_join_sql() in /includes/common.inc(1841) : eval()'d code on line 2