Back to vBulletin 3.7 Add-ons

Master Forum / All Topics - View Posts from Multiple Forums in a Single Forum
Mod Version: 1.00, by BirdOPrey5

This modification is in the archives.
vB Version: 3.7.x Rating: (1 vote - 5.00 average) Installs: 3
Released: 05 Jul 2010 Last Update: Never Downloads: 0
Not Supported Code Changes Translations  

Note: This mod was developed for 3.8.x but I have confirmed it works the same for 3.7.x, visit the 3.8 mod for some extra options: All Topic / Master Forums - View Threads from Multiple Forums in a Master Forums it is the same instructions and code.

This is a way to display posts from various forums and/or subforums in a single forum. This is in part based on this article: Show all subforum threads in main forum for vB3.7.x (no extra queries) which allows you to view sub-forum posts in the parent forum. This mod goes a step further and lets you view posts from any forum, subforum or not, and only does so for a single forum, not every forum like the original article.

See post # 2 in this thread for an option for having multiple master forums.

Note: This does not share posts between different sites (domains), merely between forums (categories) on your own site. If you need to share posts between completely different sites check out this mod. (not mine!)

Another Note: You need go edit the forumdisplay.php file to do this, I strongly suggest you backup this file by making a copy before editing and calling it forumdisplay.old or such so you can easily switch back if something goes wrong. I also suggest you close your forum while making these changes.

This mod adds NO additional queries to the database, it should be very efficient.

Open forumdisplay.php in your favorite text editor.

There are two to three edits we have to make, the first and last are required, the middle one is optional- I will explain when we get to it.

Note: See post #4 in the 3.8 thread for an option to let users choose to enable/disable the system. If you want to do this follow the instructions in post 4 before making the edits.

Edit 1. Find:
PHP Code:
    $threadscount $db->query_first_slave("
        SELECT COUNT(*) AS threads, SUM(IF(thread.lastpost > 
$lastread AND open <> 10, 1, 0)) AS newthread
        
$hook_query_fields
        FROM " 
TABLE_PREFIX "thread AS thread
        
$tachyjoin
        
$hook_query_joins
         WHERE forumid = 
$foruminfo[forumid]
            AND sticky = 0
            
$prefix_filter
            
$visiblethreads
            
$globalignore
            
$limitothers
            
$datecut
            
$hook_query_where 
Replace with:
PHP Code:
//Edit added if-else statement
if ($foruminfo[forumid] == 1) {
    
$threadscount $db->query_first_slave("
        SELECT COUNT(*) AS threads, SUM(IF(thread.lastpost > 
$lastread AND open <> 10, 1, 0)) AS newthread
        
$hook_query_fields
        FROM " 
TABLE_PREFIX "thread AS thread
        
$tachyjoin
        
$hook_query_joins
          WHERE forumid IN (1, 2, 3)
            AND sticky = 0
            
$prefix_filter
            
$visiblethreads
            
$globalignore
            
$limitothers
            
$datecut
            
$hook_query_where
    "
);
}
else {
    
$threadscount $db->query_first_slave("
        SELECT COUNT(*) AS threads, SUM(IF(thread.lastpost > 
$lastread AND open <> 10, 1, 0)) AS newthread
        
$hook_query_fields
        FROM " 
TABLE_PREFIX "thread AS thread
        
$tachyjoin
        
$hook_query_joins
         WHERE forumid = 
$foruminfo[forumid]
            AND sticky = 0
            
$prefix_filter
            
$visiblethreads
            
$globalignore
            
$limitothers
            
$datecut
            
$hook_query_where
    "
);

In the code above replace the number 1 in the if ($foruminfo[forumid] == 1) statement with the forum id of what you want to be the "Master Forum" - The forum from which you can view the other forum's posts.
Also replace the numbers 1,2,3 in the WHERE forumid IN (1, 2, 3) statement with the forum id's of all the forums you want to be able to view the posts of, you can have as many or as few forum ids here as you want, I have about 18 myself. Be sure you include the number of the "Master Forum" in this set. Separate id's with commas.

On to our second edit. This one is a little trickier because it's already inside an IF statement but follow exactly and you'll be OK...

This is the optional edit. Make this edit only if you want sticky threads from the other forums to appear as sticky threads in the "Master Forum." This could get ugly if you have stickies in every forum like I do so personally I skipped this step but tested it to make sure it works. Note: If you don't do this sticky threads will not show at all in the "Master Forum" until unstuck from their respective forum.
Edit 2 (Optional). Find:
PHP Code:
        $stickies $db->query_read_slave("
            SELECT thread.threadid, lastpost, open
            FROM " 
TABLE_PREFIX "thread AS thread
             WHERE forumid = 
$foruminfo[forumid]
                AND sticky = 1
                
$prefix_filter
                
$visiblethreads
                
$limitothers
                
$globalignore 
Replace With:
PHP Code:
 //Edit added if-else statement
           
if ($foruminfo[forumid] == 1) {
        
$stickies $db->query_read_slave("
            SELECT thread.threadid, lastpost, open
            FROM " 
TABLE_PREFIX "thread AS thread
            WHERE forumid IN (1, 2, 3)
                AND sticky = 1
                
$prefix_filter
                
$visiblethreads
                
$limitothers
                
$globalignore
        "
);
        }
        else {
        
$stickies $db->query_read_slave("
            SELECT thread.threadid, lastpost, open
            FROM " 
TABLE_PREFIX "thread AS thread
             WHERE forumid = 
$foruminfo[forumid]
                AND sticky = 1
                
$prefix_filter
                
$visiblethreads
                
$limitothers
                
$globalignore
        "
);        
        } 
Like before change the numbers in the if and where statements to your needs.

Edit 3 (required). Find:
PHP Code:
    $getthreadids $db->query_read_slave("
        SELECT " 
iif($sortfield == 'voteavg'$votequery) . " thread.threadid,
            
$tachy_columns
            
$hook_query_fields
        FROM " 
TABLE_PREFIX "thread AS thread
        
$tachyjoin
        
$hook_query_joins
      WHERE forumid = 
$foruminfo[forumid]
            AND sticky = 0
            
$prefix_filter
            
$visiblethreads
            
$globalignore
            
$limitothers
            
$datecut
            
$hook_query_where
        ORDER BY sticky DESC, 
$sqlsortfield $sqlsortorder. (!empty($sqlsortfield2) ? ", $sqlsortfield2 $sqlsortorder'') . "
        LIMIT 
$limitlower$perpage
    "
); 
Replace With:
PHP Code:
//Edited added if-else statement
  
if ($foruminfo[forumid] == 1){
     
$getthreadids $db->query_read_slave("
        SELECT " 
iif($sortfield == 'voteavg'$votequery) . " thread.threadid,
            
$tachy_columns
            
$hook_query_fields
        FROM " 
TABLE_PREFIX "thread AS thread
        
$tachyjoin
        
$hook_query_joins
          WHERE forumid IN (1, 2, 3)
            AND sticky = 0
            
$prefix_filter
            
$visiblethreads
            
$globalignore
            
$limitothers
            
$datecut
            
$hook_query_where
        ORDER BY sticky DESC, 
$sqlsortfield $sqlsortorder. (!empty($sqlsortfield2) ? ", $sqlsortfield2 $sqlsortorder'') . "
        LIMIT 
$limitlower$perpage
    "
); 
}
  else {
    
$getthreadids $db->query_read_slave("
        SELECT " 
iif($sortfield == 'voteavg'$votequery) . " thread.threadid,
            
$tachy_columns
            
$hook_query_fields
        FROM " 
TABLE_PREFIX "thread AS thread
        
$tachyjoin
        
$hook_query_joins
      WHERE forumid = 
$foruminfo[forumid]
            AND sticky = 0
            
$prefix_filter
            
$visiblethreads
            
$globalignore
            
$limitothers
            
$datecut
            
$hook_query_where
        ORDER BY sticky DESC, 
$sqlsortfield $sqlsortorder. (!empty($sqlsortfield2) ? ", $sqlsortfield2 $sqlsortorder'') . "
        LIMIT 
$limitlower$perpage
    "
);

Once again change the numbers in the if and where statements to your needs.

Now wipe the sweat off your face and save and upload the file. Make sure this file has the same chmod (read/write permissions) as your original forumdisplay.php file.

I suggest making a few test posts to make sure everything is working like you expect before re-opening your forum.

Why would anyone do this you might ask... All I can say is that if you never thought about this you probably don't need it, but I've been looking for this for 2 years with numerous requests for it that went unanswered. I have a mainly off-topic forum but I like to 'file' my posts into various 'on-topic' categories where appropriate. Many users complained about threads being moved because some didn't like browsing sub-forums although I feel it was essential to move them for future reference, archiving, and SEO purposes. This basically solves the problem of people who want one massive OT forum and those who like to keep things neat and apart.

I'm sorry all of these are manual edits... if someone can find a way to make these automatic they have my permission to release it as their own mod, for the good of the community.

Please remember to mark as installed if you use this.

NEW: See posts 6 and 7 in the 3.8 thread for a couple of additional options you may be interested in if using this mod.

Screen Shots- The first one is the original forum the post was made in, in this case "Off Topic Light." The second image is the "Master Forum" or "Off Topic," as you can see the the top post from the secondary forum is also listed in the master forum. All posts from the secondary forum are also in the Master forum, just further down the page then the screen shot captures.
SS1: &d=1277758531
SS2: &d=1277758531

Download

No files for download.

Similar Mods

Forum Display Enhancements All Topic - Master Forums - Shows threads from multiple forums in one forum vBulletin 4.x Add-ons
Forum Display Enhancements All Topic / Master Forums - View Threads from Multiple Forums in a Master Forums vBulletin 3.8 Add-ons

vblts.ru supports vBulletin®, 2022-2024