Back to vBulletin 3.8 Add-ons

Adding subforums option for external.php
Mod Version: 3.8.0.0, by DarkSoroush

vB Version: 3.8.2 Rating: (1 vote - 5.00 average) Installs: 3
Released: 12 Nov 2010 Last Update: 12 Nov 2010 Downloads: 24
Not Supported Uses Plugins Re-usable Code  

Very quick and easy modification to add an option for including sub-forums in external.php
It is very odd why there isn't any trick in internet about this and no Mod.

Automatic Install:
Using xml file and try to Install Product.

Manual Install:
Go to plug-ins section. Click to add new plug-in. Then Select "external_start" as hook location, enter a name like "External Subforums Addon" or something, Then copy below code to "PHP Plug-in Code" and select Yes from "Enable Plug-In" then click Save.

PHP Code:
function GetSubs($fid){
    global 
$db;
    
$fidsq $db->query_read_slave("SELECT childlist
                                        FROM  " 
TABLE_PREFIX "forum
                                        WHERE forumid = "
.$db->escape_string($fid)."
    "
);
    if (
$fids $db->fetch_array($fidsq)){
        
$fids str_replace(',-1','',$fids['childlist']);
        return 
$fids;
    }else{
        return 
$fid;
    }
}

if (
$_REQUEST['subforums'] && $_REQUEST['subforums']==1){
    if (
$_REQUEST['forumids']){
        foreach (
explode(',',$_REQUEST['forumids']) as $fid){
            
$_REQUEST['forumids'] = trim(GetSubs($fid).','.$_REQUEST['forumids'],',');
        }
    }elseif(
$_REQUEST['forumid']){
        
$_REQUEST['forumids'] = GetSubs($_REQUEST['forumid']);
    }
}

if (
$_REQUEST['forumids']){
    
// quick way of getting the first value
    
$_REQUEST['forumid'] = intval($_REQUEST['forumids']);

How to use?
Only add subforums=1 at end of external.php address. For example:

mysite.com/forum/external.php?type=RSS2&forumids=115,67&subforums=1
Or:
mysite.com/forum/external.php?type=RSS2&forumid=16&lastpost=1&subforums=1
Or:
mysite.com/forum/external.php?type=RSS&forumid=67&subforums=1
Or:
mysite.com/forum/external.php?type=XML&forumids=115&lastpost=1&subforums=1
etc ...

Advantages:
1. Comparing to manual adding of forum ids to address, It help users from missing new topics or posts when you make an other sub-forum but bookmarks of users are old.
2. And make better address for rss of course.
3. Also, You don't need any change of forums code to add updated rss links to your forum list. You can use a simple mod like "index.php?t=211957". No need to install complete solution like this one: "index.php?t=203358".

Download

File Type: %1$s External Sub-forums addon.xml (2.1 KB, 24 downloads)


vblts.ru supports vBulletin®, 2022-2025