Joined: September 2007
Posts: 482
Location: Right in front of my computer
Recent Topics Blocks From Certain Forums
Hi,
I created a Recent Topics block and would like to have certain forums new recent topics. The Random Block has an option to pull from certain forum, but don't like it because they could be old topics.
Joined: November 2006
Posts: 494
Location: Madrid (Spain)
Re: Recent Topics Blocks From Certain Forums
Updated on 29th January 2009
What is this mod for?
This recent topic block extends the functionalities of the standard one without having to uninstall or modify the older one. The new functionalities are:
You are able to choose which forums to look for recent topics (by specifying ids separated by commas)
You can sort the topics alphabetically, or by date.
It's possible to group the topics by it's first letter
You can add up to five Recent Topic blocks per page (by default; it's explained below how to create more blocks)
If you don't understand something, the best way to see how it works is installing it.
Installation instructions
There's only one file modification. Please repeat it on every style you've installed.
Opentemplates/mg_styles/common.css At the very end of the file, add
Download the attached file (recent_topics_k1-5.zip)
Extract the file you've downloaded
Upload everything contained on ip_root folder to your forum root.
How to use Recent Topics K
The first thing you have to do is going into CMS management and then to the layout in which you wish to add the block(s). There, click Add block button and fill the form. In Block file, choose: recent topics k(1-5)*. Don't check Localize Titlebar, because the block's title doesn't have any language reference. Then Submit the form and you'll get a new form. Choose the options you like the most and submit the form. You will be able to see the new block on your cms page. Please repeat this procedure for each Recent Topic block you wish to add.
*(1-5) means any number between 1 and 5, and you are able to add more numbers by following the steps specified below. Please note: if you add two blocks with the same number in the same cms page, you'll get an awful error.
I need more recent topics blocks, what should I do?
The process is easy.
Go to /blocks/ dir and find this two files: blocks_imp_recent_topics_k1.php and blocks_imp_recent_topics_k1.cfg. Duplicate them and rename the copied files to blocks_imp_recent_topics_k6*.php and blocks_imp_recent_topics_k6*.cfg. Open both files using Notepad, WordPad, Dreamweaver, or any plain text editor you use, and use the Find&Replace function to replace all "k1" on the code (without inverted commas) for "k6"* (without inverted commas).
Then go to /templates/mg_styles/blocks/, duplicate the recent_topics_k1_block.tpl file located there and rename the copied file to recent_topics_k6*_block.tpl. Open the new file using Notepad, WordPad, Dreamweaver, or any plain text editor you use, and use the Find&Replace function to replace all "k1" on the code (without inverted commas) for "k6"* (without inverted commas). Repeat this step on every style you've installed.
*6 is the next number in the recent topic blocks list. If the last file you have is k5, this number must be 6; if the last file you have is k6, this number must be 7; and so on.
Older verision. Still works but not recommended (outdated).
array('Recent Topics Style', 'choose static display or scrolling display', 'md_recent_topics_style', 'Scroll,Static', '1,0', '3', 'recent_topics', '1'),
array('Recent Topics from certain forums', 'choose if recent topics will be only from a restricted ids', 'md_recent_topic_certain_forums', 'Yes,No', '1,0', '3', 'recent_topics', '0'),
array('Recent Topics IDs', 'Specify forum IDs to display recent topics', 'md_recent_topic_ids', '', '', '1', 'recent_topics', '')
Joined: September 2007
Posts: 482
Location: Right in front of my computer
Re: Recent Topics Blocks From Certain Forums
Thank you KasLimon, it works. But there are few issues, the forum id(s) save some where after you create a block.
1 let say i create block 1 and assign forum 1,2,3,4,5. if i change my mind delete forum 5 but add forum 6 (ex: 1,2,3,4,6), then my block still shows topics from forum 5 even it's not listed on my block configuration.
2 I delete the block 1 (above) that I create new block and assign 1,2,3,4,6 and my block still have forum 5 topics.
I have cleared site cache, that did not help. Any ideals??
Joined: September 2007
Posts: 482
Location: Right in front of my computer
Re: Recent Topics Blocks From Certain Forums
Here you go, Check it out. I created 3 blocks, 1 for strolling recent from forum ID 4 ONLY, 1 block from forum ID 15 ONLY and the other recent wide block for all forums ('cause there is no option). somehow it mixed up each other and recent block shows twice.
Joined: September 2007
Posts: 482
Location: Right in front of my computer
Re: Recent Topics Blocks From Certain Forums
well, it's not working. I deleted all recent blocks, cleared cache, then created 3 new ones. 1 recent topics block from forum 4, another recent topics block from forum 5 only, but some how the 1st block includes in this block too. Not yet, i created 1 recent topics wide block and this includes both of my first blocks. I double, triple check my edit and can't find any different than your instructions. I am going to post them here for another pairs of eyes, just in case.
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if ( !defined('IN_PHPBB') )
{
die('Hacking attempt');
}
$sql = "SELECT t.topic_id, t.topic_title, t.topic_last_post_id, t.forum_id, p.post_id, p.poster_id, p.post_time, u.user_id, u.username
FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . USERS_TABLE . " AS u
WHERE t.forum_id NOT IN (" . $except_forums . ")
AND t.topic_status <> 2
AND p.post_id = t.topic_last_post_id
AND p.poster_id = u.user_id
$extra
$forum_ids
ORDER BY p.post_time DESC
LIMIT " . $cms_config_vars['md_num_recent_topics'][$block_id];
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
if ( !defined('IN_PHPBB') )
{
die('Hacking attempt');
}
The time now is Tue 26 Aug, 2025 01:02 • All times are UTC + 1 Hour [DST enabled]
Permissions List
Permissions List
You cannot post new topics You cannot reply to topics You cannot edit your posts You cannot delete your posts You cannot vote in polls You cannot attach files You can download files You cannot post calendar events