Customizing SMF > Joomla Bridge Support

Shared Forum Mod

(1/64) > >>

Goosemoose:
Orstio and I came up with a way to run multiple forums from 1 database, 1 directory, 1 installation. I'm running 7 forums and I only need to upgrade once, install mods once, and my users are shared :)

First the examples. Note the number of Categories that show in each, and that some are shared. some aren't.

http://www.goosemoose.com/component/option,com_smf/Itemid,118/forum,rat
http://www.goosemoose.com/component/option,com_smf/Itemid,118/forum,cat
http://www.goosemoose.com/component/option,com_smf/Itemid,118/forum,dog
http://www.goosemoose.com/component/option,com_smf/Itemid,118/forum,hedgehog
http://www.goosemoose.com/component/option,com_smf/Itemid,118/forum,rabbit
http://www.goosemoose.com/component/option,com_smf/Itemid,118/forum,ferret
http://www.goosemoose.com/component/option,com_smf/Itemid,118/forum,bird

Ok, you can do it without the Mambo/Joomla bridge but it's no where near as good. We used the power of the bridge to rewrite all the links. Basically what you do is create a new table smf_forums that houses two fields, forumName and catList. Here is an example of what it could look like with 3 forums that share some categories, and have some unique. This all works off of ONE smf directory!

forumName catList
Rat 1,2,3,4
Cat 1,5,6,7
Dog 1,4,8,9

Ok so here are the steps.

1. Run this in phpMyAdmin
Code:


CREATE TABLE IF NOT EXISTS `smf_forums` (
  `forumName` text NOT NULL,
  `catList` varchar(128) NOT NULL default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


2. Go in and add your fields like the example above forumName is the name you'll be passing in, catList are the category id's you want to display for that forum. If your prefix isn't smf_ , make sure to change it.

3. Edit Load.php

In Load.php

Find:
Code:

$user_info['query_see_board'] = '(FIND_IN_SET(' . implode(', b.memberGroups) OR FIND_IN_SET(', $user_info['groups']) . ', b.memberGroups))';   


Add After:
Code:

// Added for the multiple forum mod
    if(!empty($_REQUEST['forum']) && !isset($_REQUEST['action']) && !isset($_REQUEST['board']) &&!isset($_REQUEST['topic'])){
      $forumList = db_query("SELECT catList FROM {$db_prefix}forums WHERE forumName = '$_REQUEST[forum]'", __FILE__, __LINE__);
      $row_forumList = mysql_fetch_assoc($forumList);
      $user_info['query_see_board'] .= ' AND FIND_IN_SET(c.ID_CAT, "' . $row_forumList['catList'] . '")';     
   }


4. In BoardIndex.php (in Sources dir)

find:
Code:
         AND b.childLevel <= 1" : ''), __FILE__, __LINE__);

replace with:
         AND b.childLevel <= 1" : '') . " ORDER BY c.catOrder, b.boardOrder ASC" , __FILE__, __LINE__);

5. In smf.php in the component directory for the bridge, this $myurl= line is in 4 places but slightly different each time. You can copy the same line to all 3 places without a problem.

For version 1.1x of the bridge do the following:
From

--- Code: --- $myurl = $mosConfig_live_site . '/' . basename($_SERVER['PHP_SELF']) . '?option=com_smf&amp;Itemid=' . $Itemid . '&amp;';
--- End code ---

To

--- Code: --- $myurl = $mosConfig_live_site . '/' . basename($_SERVER['PHP_SELF']) . '?option=com_smf&amp;Itemid=' . $Itemid . '&amp;'
 . (isset($_REQUEST['forum']) ? 'forum='.$_REQUEST['forum'].'&amp;' : '');

--- End code ---

From

--- Code: ---$myurl = basename($_SERVER['PHP_SELF']) . '?option=com_smf&amp;Itemid=' . $_REQUEST['Itemid'] . '&amp;' ;
--- End code ---

To

--- Code: ---$myurl = basename($_SERVER['PHP_SELF']) . '?option=com_smf&amp;Itemid=' . $_REQUEST['Itemid'] . '&amp;'
 .  (isset($_REQUEST['forum']) ? 'forum='.$_REQUEST['forum'].'&amp;' : '');

--- End code ---

-------------
In older versions of the bridge do the following to smf.php
Find:
Code:

$myurl = $mosConfig_live_site . '/' . basename($_SERVER['PHP_SELF']) . '?option=com_smf&amp;Itemid=' . $Itemid. '&amp;';

and find:

$myurl = $mosConfig_live_site . '/' . basename($_SERVER['PHP_SELF']) . '?option=com_smf&amp;Itemid=' . $Itemid . '&amp;';


Replace both with:
Code:

$myurl = $mosConfig_live_site . '/' . basename($_SERVER['PHP_SELF']) . '?option=com_smf&amp;Itemid=' . $Itemid. '&amp;'.  (isset($_REQUEST['forum']) ? 'forum='.$_REQUEST['forum'].'&amp;' : '');

Find:

   $myurl = sefReltoAbs(basename($_SERVER['PHP_SELF']) . '?option=com_smf&amp;Itemid=' . $_REQUEST['Itemid'] . '&amp;' );

Replace with:

    $myurl = sefReltoAbs(basename($_SERVER['PHP_SELF']) . '?option=com_smf&amp;Itemid=' . $_REQUEST['Itemid'] . '&amp;' .  (isset($_REQUEST['forum']) ? 'forum='.$_REQUEST['forum'].'&amp;' : ''));
----------------------------------------------

6. The following fix thanks to Kingconnor

Open "yourforumdir/Sources/BoardIndex.php" and find the following code

$result_boards = db_query (around line 71)

Add above that the following code (might look familiar)

   // Added for the multiple forum mod
    if(!empty($_REQUEST['forum']) && !isset($_REQUEST['board']) &&!isset($_REQUEST['topic'])){
      $forumList = db_query("SELECT catList FROM {$db_prefix}forums WHERE forumName = '$_REQUEST[forum]'", __FILE__, __LINE__);
      $row_forumList = mysql_fetch_assoc($forumList);
     $user_info['query_see_board'] .= ' AND FIND_IN_SET(c.ID_CAT, "' . $row_forumList['catList'] . '")';
   }

7. Create a link to your new forums! Here is an example using SEF:
http://www.goosemoose.com/component/option,com_smf/Itemid,118/forum,rat
http://www.goosemoose.com/component/option,com_smf/Itemid,118/forum,cat
http://www.goosemoose.com/component/option,com_smf/Itemid,118/forum,dog

Without SEF would be like this (note I use SEF so it will switch after the first page)
http://www.goosemoose.com/index.php?option=com_smf&Itemid=118&forum=rat

Note that if you leave the forum part off you see all the boards.

chadness:
Wow, that's incredible!  Great work!  Though, my capybara feels slighted.

Goosemoose:
Glad you like it. Do you really have a capybara? You should post some pictures on the forum. Those are huge! I am planning on adding quite a few more forums. I was able to add 5 additional forums in a matter of minutes which makes it so I can add more animal sections now :)

chadness:
I don't really, I just wanted to give you a hard time. :)  I just have your standard pets, an okapi and a puffin.  Or maybe they're a dog and a cat.

SeaOfSin:
Great mod, this is exactly what I was looking for but two things, firstly when I add the following line I get this error

Parse error: parse error, unexpected ';' in /home/revolut/public_html/components/com_smf/smf.php on line 494

Find:

   $myurl = sefReltoAbs(basename($_SERVER['PHP_SELF']) . '?option=com_smf&amp;Itemid=' . $_REQUEST['Itemid'] . '&amp;' );

Replace with:

    $myurl = sefReltoAbs(basename($_SERVER['PHP_SELF']) . '?option=com_smf&amp;Itemid=' . $_REQUEST['Itemid'] . '&amp;' .  (isset($_REQUEST['forum']) ? 'forum='.$_REQUEST['forum'].'&amp;' : '');

If I keep the line as it is it works fine. Is this going to be a problem?

Secondly when I access the separate forums the board order is messed up. Is there any way to resolve that?

Navigation

[0] Message Index

[#] Next page

Go to full version