Refine recent topics block to particular forum

Events happening in the community are now at Drupal community events on www.drupal.org.
archard-gdo's picture

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

arkepp's picture

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

archard-gdo's picture

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

archard-gdo's picture

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

arkepp's picture

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!

archard-gdo's picture

It worked :)

Thanks arkepp!

phpbb

Group organizers

Group notifications

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

Hot content this week