Thanks for the simple RSS mod. I was looking for this, but wanted just a bit more. Our forum is quite diverse, and receiving updates for the entire board, via RSS, is not desired for many users. The following modifications alter this mod to generate an RSS feed for the current topic (and its children/grandchildren).
For instance, if you are viewing the root of the board (f=0), an RSS for the entire board is generated. However, if you are viewing a particular forum (f=33), by clicking the RSS icon, you get a feed that includes all posts for f=33 and all children and grandchildren.
This is a mod of the mod. It depends on you having already installed the original mod.
In rss.php, find:
Code: Select all
include($phpbb_root_path . 'language/en/common.' . $phpEx);
add the following on a blank line after:
Code: Select all
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
In rss.php, find:
Code: Select all
//Get the board url address
$board_url = generate_board_url();
add the following on a blank line after:
Code: Select all
if (!$f){
$f = 'AND f.forum_id = f.forum_id';
} else {
$rows = get_forum_branch($f, 'children', 'descending', true);
$f='AND (';
foreach ($rows as $row){
$f .= 'OR f.forum_id = ' . $row['forum_id'] . "\n";
}
$f.=')';
$f = str_replace("(OR ","(",$f);
}
In rss.php, find:
Code: Select all
$sql = 'SELECT f.forum_id,f.forum_name, f.forum_desc_options, t.topic_title, t.topic_id,t.topic_last_post_id,t.topic_last_poster_name, p.post_time, p.post_text,
p.bbcode_uid, p.bbcode_bitfield, u.username, u.user_id
FROM '. FORUMS_TABLE .' f,'.TOPICS_TABLE.' t, '.POSTS_TABLE.' p,'.USERS_TABLE.' u
WHERE t.forum_id = f.forum_id
AND t.topic_status != 1
AND p.post_id = t.topic_last_post_id
AND u.user_id = p.poster_id
ORDER BY t.topic_last_post_id DESC';
replace with:
Code: Select all
$sql = 'SELECT f.forum_id,f.forum_name, f.forum_desc_options, t.topic_title, t.topic_id,t.topic_last_post_id,t.topic_last_poster_name, p.post_time, p.post_text,
p.bbcode_uid, p.bbcode_bitfield, u.username, u.user_id
FROM '. FORUMS_TABLE .' f,'.TOPICS_TABLE.' t, '.POSTS_TABLE.' p,'.USERS_TABLE.' u
WHERE t.forum_id = f.forum_id
AND t.topic_status != 1
AND p.post_id = t.topic_last_post_id
AND u.user_id = p.poster_id
'.$f.'
ORDER BY t.topic_last_post_id DESC';
in includes/functions.php, find:
Code: Select all
'U_RSS' =>append_sid("{$phpbb_root_path}rss.$phpEx"),
replace with:
Code: Select all
'U_RSS' =>append_sid("{$phpbb_root_path}rss.$phpEx") . (($f === 0 || !(empty($f))) ? '?f=' . $f : ''),
The above code may not follow guidelines, so I welcome optimizations/corrections by those smarter and more inclined. I'm particularly concerned about the inclusion of the admin_functions, but think the original mod does due-diligence in preventing unauthorized access.
These simple additions to the already brilliant RSS feed mod, I think, make it even more useful. Thanks again for the original work.