https://www.icyphoenix.com/viewtopic.php?f=28&t=3781&p=25919#p25919
-----------------------------------
xmenfile
Wed 12 Mar, 2008 06:52

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.
 
[spoiler]<?php
/***************************************************************************
 *                      blocks_imp_recent_topic.php
 *                          -------------------
 *   begin                : 2007/02/06
 *   copyright            : Mighty Gorgon
 *   website              : http://www.mightygorgon.com
 *   email                : mightygorgon@mightygorgon.com
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   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');
}

if(!function_exists(imp_recent_topics_block_func))
{
	function imp_recent_topics_block_func()
	{
		global $template, $cms_config_vars, $block_id, $userdata, $board_config, $db, $phpEx, $var_cache, $lang, $bbcode;
		include_once($phpbb_root_path . 'includes/functions_groups.' . $phpEx);

		$template->_tpldata['recent_topic_row.'] = array();
		//reset($template->_tpldata['recent_topic_row.']);

		$bbcode->allow_html = $html_on;
		$bbcode->allow_bbcode = $bbcode_on;
		$bbcode->allow_smilies = $smilies_on;

		$except_forums = build_exclusion_forums_list();

		$current_time = time();
		$extra = "AND t.topic_time <= $current_time";
		$forum_ids = ''; 
        if ($cms_config_vars['md_recent_topic_certain_forums'][$block_id] && !empty($cms_config_vars['md_recent_topic_ids'][$block_id])) 
        { 
            $forum_ids = 'AND t.forum_id IN(' . $cms_config_vars['md_recent_topic_ids'][$block_id] . ')'; 
        }

		$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];

		if (!$result1 = $db->sql_query($sql))
		{
			message_die(GENERAL_ERROR, 'Could not query recent topics information', '', __LINE__, __FILE__, $sql);
		}
		$number_recent_topics = $db->sql_numrows($result1);
		$recent_topic_row = array();
		while ($row1 = $db->sql_fetchrow($result1))
		{
			$recent_topic_row[] = $row1;
		}

		if($cms_config_vars['md_recent_topics_style'][$block_id])
		{
			$style_row = 'scroll';
		}
		else
		{
			$style_row = 'static';
		}

		$template->assign_block_vars($style_row, '');

		for ($i = 0; $i < $number_recent_topics; $i++)
		{
			$orig_word = array();
			$replacement_word = array();
			obtain_word_list($orig_word, $replacement_word);

			if ( !empty($orig_word) )
			{
				$recent_topic_row[$i]['topic_title'] = ( !empty($recent_topic_row[$i]['topic_title']) ) ? preg_replace($orig_word, $replacement_word, $recent_topic_row[$i]['topic_title']) : '';
			}
			$recent_topic_row[$i]['username'] = colorize_username($recent_topic_row[$i]['user_id']);
			if ($recent_topic_row[$i]['user_id'] != -1)
			{
				$template->assign_block_vars($style_row . '.recent_topic_row', array(
					'U_TITLE' => append_sid(VIEWTOPIC_MG . '?' . POST_FORUM_URL . '=' . $recent_topic_row[$i]['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $recent_topic_row[$i]['topic_id'] . '&amp;' . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#p' .$recent_topic_row[$i]['post_id'],
					'L_TITLE' => $bbcode->parse($recent_topic_row[$i]['topic_title'], $bbcode_uid, true),
					'L_BY' => $lang['By'],
					'L_ON' => $lang['On'],
					'U_POSTER' => append_sid(PROFILE_MG . '?mode=viewprofile&amp;' . POST_USERS_URL . '=' . $recent_topic_row[$i]['user_id']),
					'S_POSTER' => $recent_topic_row[$i]['username'],
					'S_POSTTIME' => create_date2($board_config['default_dateformat'], $recent_topic_row[$i]['post_time'], $board_config['board_timezone'])
					)
				);
			}
			else
			{
				$template->assign_block_vars($style_row . '.recent_topic_row', array(
					'U_TITLE' => append_sid(VIEWTOPIC_MG . '?' . POST_FORUM_URL . '=' . $recent_topic_row[$i]['forum_id'] . '&amp;' . POST_TOPIC_URL . '=' . $recent_topic_row[$i]['topic_id'] . '&amp;' . POST_POST_URL . '=' . $recent_topic_row[$i]['post_id']) . '#p' .$recent_topic_row[$i]['post_id'],
					'L_TITLE' => $bbcode->parse($recent_topic_row[$i]['topic_title'], $bbcode_uid, true),
					'L_BY' => $lang['By'],
					'U_POSTER' => append_sid(PROFILE_MG . '?mode=viewprofile&amp;' . POST_USERS_URL . '=' . $recent_topic_row[$i]['user_id']),
					'S_POSTER' => $recent_topic_row[$i]['post_username'],
					'S_POSTTIME' => create_date2($board_config['default_dateformat'], $recent_topic_row[$i]['post_time'], $board_config['board_timezone'])
					)
				);
			}
		}
	}
}

imp_recent_topics_block_func();

?>[/spoiler]

block_imp_recent_topics.cfg
[spoiler]<?php
/***************************************************************************
 *                       blocks_imp_recent_topics.cfg
 *                            -------------------
 *   begin                : 2007/02/06
 *   copyright            : Mighty Gorgon
 *   website              : http://www.mightygorgon.com
 *   email                : mightygorgon@mightygorgon.com
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   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');
}

// array( <Field label>, <Field Info>, <Config Name>, <Options>, <Field Values>, <Control Type>, <Block>, <Default Value>);

$block_variables = array(
	array('Number of recent topics', 'number of topics displayed', 'md_num_recent_topics', '', '', '1', 'recent_topics', '10'),
	   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', '')
);

$block_count_variables = count($block_variables);

?>[/spoiler]


