Refine recent topics block to particular forum

Events happening in the community are now at Drupal community events on www.drupal.org.
Posted by archard-gdo on April 3, 2008 at 3:23am

What I want to do, is make a forum called "Announcements", and post important site updates in that forum. I'd also like to have links to these topics displayed prominently on the front page of drupal. So I was wondering if there is a way to maybe duplicate the recent posts block but confine it to a particular forum. Maybe it's just matter of adding a simple if statement to the existing code - maybe it's a lot harder than that. I haven't taken a good look at it yet, but I hope to get a general idea of the feasibility of something like this.

Comments

It should be easy, just look

Posted by arkepp on April 3, 2008 at 3:32am

It should be easy, just look at the existing block and change the SQL so that it is limited to a single forum.

Yep, it was really easy. For

Posted by archard-gdo on April 6, 2008 at 12:51am

Yep, it was really easy.

For those wondering how to do it, in the phpbb_block_recent_topics.inc.php file go to line 38 where it starts

."WHERE $tg.group_name = '$gid' .... etc

and add to the end of that

AND $tt.forum_id = 2

where 2 is your desired forum ID to limit the block to.

Now I have another question

Posted by archard-gdo on April 6, 2008 at 1:21am

Now I have another question regarding the sort order of the block. Is there a way to make it so that they don't "bump" when you post a new topic in them? I just want a list of topics sorted by the time they were created. I don't see an obvious sorting mechanism in the code... but surely it has to be there?

Try changing ORDER BY

Posted by arkepp on April 6, 2008 at 2:35am

Try changing
ORDER BY $tt.topic_last_post_id
to
ORDER BY $tt.topic_id

(Not 100% sure I interpreted your question correctly)

It worked :) Thanks arkepp!

Posted by archard-gdo on April 6, 2008 at 6:24pm

It worked :)

Thanks arkepp!

phpbb

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

AltStyle によって変換されたページ (->オリジナル) /