Advertisement:

Author Topic: SMF <-> Mambo/Joomla Bridge (Combined Readme)  (Read 103513 times)

Offline Kindred

  • The Mean One
  • Local Moderator
  • SMF Legend
  • *
  • Posts: 51,429
  • Gender: Male
    • Kindred-999 on GitHub
SMF <-> Mambo/Joomla Bridge (Combined Readme)
« on: January 24, 2005, 03:57:29 PM »
This readme has not yet been updated for v1.1.3 of the bridge.
I will be updating it later today.

In addition, It is likely that none of the modules or bots for the existing bridges will work with the new (1.1.3) version of the bridge.   I will be updating the modules in this thread into two versions. Pre-1.1.3 and post-1.1.3.





The top of this thread now covers the new bridge for SMF 1.1RC2.   This bridge is v1.1.2(aka 3.20).
If you are using SMF RC1 or prior (including 1.0.x) please see the specific message further down in this thread!)



I have tried to split this thread into distinct sections, now.   Nearly the entire thread has been revised! If you are confused, please read the whole thing before asking questions!

Please also be sure to read the FAQ for v1.1.2 (aka 3.20)

http://www.technoadvice.com/advanced/developer/modify_an_smf_theme_for_joomla_and_mambo.html

« Last Edit: April 03, 2006, 11:14:05 AM by Kindred »
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline Kindred

  • The Mean One
  • Local Moderator
  • SMF Legend
  • *
  • Posts: 51,429
  • Gender: Male
    • Kindred-999 on GitHub
Installing the Bridge v1.1.1 (3.20)
« Reply #1 on: January 24, 2005, 03:57:43 PM »
The top of this thread now covers the new bridge for SMF 1.1RC2.   This bridge is v1.1.2 (aka 3.20).
If you are using SMF RC1 or prior (including 1.0.x) please see the specific message further down in this thread!)


It should be noted, before you start with this bridge...
Everything in these instructions assumes that you already have Mambo (4.5.2 or higher) or Joomla (1.0.3 or higher) and SMF (1.1RC2 ONLY!) installed and working as stand-alone utilities.

For simplicity, if you don't know exactly what you are doing:
- SMF should be installed in a "sub level" directory. (i.e. www.yoursite.com/forum or
something like that)
- Mambo can be installed in a "sub level" directory or at the top level itself.

The bridge is available HERE

START:

First, unzip the Bridge ZIP file

This will extract to create two files.
com_smf.zip
readme.html

It should be noted that these instructions assume that you have never had the bridge
installed before. If you have had the bridge previously installed, some steps may
already have been done, or may fail with the automatic installs, since the code they
are looking to modfy has already been modified.

INSTALLATION INSTRUCTIONS:

Now that you have all the files unzipped and ready to load, you can log in to your
server and start installation.

This README has a detailed instructions, but the new one-step design makes things
fairly easy and straight-forward. Make sure you read the README.HTML file first!

1 ) Install the Simple Machines Forum component.
      1a) Using Mambo Admin > Components > Install/Uninstall Component
             or Using Joomla Admin > Install/Uninstall > Component
      1b) Choose Upload File Package and Browse to the into which you extracted
             the bridge and choose the file called "com_smf.zip"
      1c) This now automatically installs the com_smf_regsitration component
             and the mod_smf_login module as well as adding a Forum menu item to
             the main menu.
 
2 ) Modify the index.php of your Mambo Template.
      5a) Go to directory MAMBO/templates/NAME
            (where MAMBO is your mambo or joomla directory and NAME is the name of the template.)
      5b) Open index.php
      5c) Add the following code just before the </HEAD> tag in index.php

Code: [Select]
<?php 
global $sc$context$settings;

if (!
defined(&#39;SMF&#39;)){
require ("administrator/components/com_smf/config.smf.php");
require (
$smf_path."/SSI.php");
}

$sc = &$context[&#39;session_id&#39;];
$_SESSION[&#39;USER_AGENT&#39;] = $_SERVER[&#39;HTTP_USER_AGENT&#39;];

mysql_select_db($mosConfig_db);

if(!empty(
$context[&#39;page_title&#39;]))
     $mainframe->setPageTitle($context[&#39;page_title&#39;]);

echo &#39;
<script language="JavaScript" type="text/javascript" src="&#39;, $settings[&#39;default_theme_url&#39;], &#39;/script.js?rc2"></script>
<script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
var smf_theme_url = "&#39;, $settings[&#39;theme_url&#39;], &#39;";
var smf_images_url = "&#39;, $settings[&#39;images_url&#39;], &#39;";
var smf_scripturl = "&#39;, $scripturl, &#39;";
// ]]></script>&#39;;

echo &#39;
<link rel="stylesheet" type="text/css" href="&#39;, $settings[&#39;theme_url&#39;], &#39;/style.css?rc2" />
<link rel="stylesheet" type="text/css" href="&#39;, $settings[&#39;default_theme_url&#39;], &#39;/print.css?beta4" media="print" />
<link rel="help" href="&#39;, $scripturl, &#39;?action=help" target="_blank" />
<link rel="search" href="&#39; . $scripturl . &#39;?action=search" />
<link rel="contents" href="&#39;, $scripturl, &#39;" />&#39;;
?>

AND add the following just above the </body> tag at the bottom of the index.php file:
Code: [Select]
<?php mysql_select_db($GLOBALS[&#39;db_name&#39;]); ?>

3 ) Configure the SMF component in Mambo/Joomla Admin.
      3a) Using the Mambo/Joomla Admin, choose Components > Simple Machines Forum > Configuration
      3b) Set the Path to SMF. This is NOT a URL! This is the absolute path to your SMF
            Installation.
            (Usually this will be something similar to /home/username/public_html/forum)
      3c) Choose if you want your Forum wrapped or unwrapped.
 
         It should be noted that there are essentially three formats to display your
         Mambo/Joomla to Forum integration:
      Wrapped:         You are using SMF through the Mambo/Joomla bridge. The Forum appears
                           "wrapped" in the Joomla/Mambotables.
      Unwrapped:      You are still using SMF through Mambo/Joomla, but it doesn't have the
                           look of a wrapped forum. It looks stand-alone, but it is actually
                           loading through Mambo/Joomla.
                           This is set in the Mambo/Joomla config for the component.
      3d) Choose if you want to use the bridge registration or the standard SMF registration.
         The bridge registration looks like mambo's registration method...
         but both options will still result in the users being added to both databases (eventually).

4 ) Configure the SMF Regsitration component in Mambo/Joomla Admin.
      4a) Using the Mambo/Joomla Admin, choose Components > Simple Machines Forum > Configuration
      4b) select your configuration options:
            Require registration agreement
            (read from agreement.txt in your forum directory)
            Ask for IM information during registration>
            Send a PM (in SMF) to the new user when they complete the registration?
            User the mambo/joomla REALNAME or USERNAME as the SMF DISPLAY NAME?
            Also register into Community Builder.
            NOTE: This is NOT integration with CB. What this does is add the user into the CB table as well. That is all...

5 ) Other Configuration notes
      5a) You will probably want to start SMF off with default settings...
      5b) If you make the Mambo/Joomla menu item (for the SMF component) available to registered
            users only, the login and registration may not function correctly.
      5c) Activation emails should be handled by Mambo/Joomla but should be duplicated in SMF (in other words, they should match!).

6 ) in Mambo/Joomla Admin > Modules > Site Modules: Unpublish the (default Mambo/Joomla) mod_login module.

7 ) in Mambo/Joomla Admin > Modules > Site Modules: Edit the mod_smf_login module.
         It is a known issue in Mambo/Joomla that modules must be "saved" at least once in order to
         be fully activated.
      7a) Choose what options you want displayed in your Login box...

8 ) In Mambo Admin > Menu > User Menu Remove the link for the User Profile.
      (You will probably not want Mambo/Joomla to handle the user information any more, unless you are using CB.)

9 ) Confirm that the Forum Menu Item in Mambo/Joomla > Menu > MainMenu is indeed pointing to the Component - SMF - Bridge, and that the menu item is Public. If it is not, then delete that menu itme and add a new one pointing to the SMF - Bridge component.

10 ) In Mambo/Joomla Admin > Site > Trash Manager: Click on the Menu Items tab and delete all
the trashed items... (this cleans up the ItemID stuff. If you ever uninstall your smf
bridge, you will want to delete the old menu item and remove the trash before adding
a new version of the bridge. Otherwise Mambo/Joomla may get confused as to which ItemID the
real bridge is using.)


THEMING:

Changing the SMF doc_type from xhtml to html will handle many of the basic "super
large font" issues.
The can be done by changing the line near the top of index.template.php in your SMF
Theme directory.
However, some of the Mambo/Joomla templates and SMF themes do not play well together.

In the Mambo Template, fixed width templates of less than 500 pixels width are
difficult for SMF to "fit in".
You have two main options.
The first is to increase the basic width of the Mambo/Joomla Template.
-> In MAMBO/templates/TEMPLATE_NAME/index.php, change the width call of the main
table to something larger...

The second option, which may require some tweaking, is the change the Mambo/Joomla Template
into a variable width template.
-> In MAMBO/templates/TEMPLATE_NAME/index.php, change the width call of the main
table 100%...

In addition to the width issues, there are some overlaps in the CSS entries between
Mambo/Joomla and SMF.
The CSS files for Mambo and SMF have some duplicate values that may conflict.
A proper design of the bridged site will include personalized templates/themes for
Mambo/Joomla and SMF that
will avoid this situation. This may take some time (and effort), however. You can
make a "quick and dirty"
merge of the CSS files by doing the following:

Open the MAMBO/templates/TEMPLATE_NAME/css/template_css.css file
Open the SMF/Themes/THEME_NAME/style.css file

Copy all of the SMF Theme file into the Mambo/Joomla template file.
Remove the Duplicate entries from the newly copied portion.
(In other words, if the CSS entry exists in the Mambo/Joomla template, delete the entry in
the newly created SMF section)
Now save it, and then remove the same "duplicate" entries in the style.css file in
your SMF theme directory.

FIXING LINKS IN SMF MESSAGES FROM PRE-BRIDGED FORUMS

(thanks to goosemoose for this)
If you were running a forum prior to bridging it with mambo, there will be links in
messages that point to the unbridged forum location. You can change these by going
into phpMyAdmin and running a simple SQL command on the smf_messages table.

The format is:
Code: [Select]
UPDATE smf_messages SET `body` = replace(`body`,"http://www.YOURSITE.com/forum/index.php?","http://www.YOURSITE.com/index.php?option=com_smf&Itemid=##&")

where smf_messages is your actual table (change the smf_ if you are using a different
prefix, obviously)
where http://www.yoursite.com/forum/index.php is the actual URL of your previous
(unbridged) SMF index.php.
where http://www.yoursite.com/mambo/index.php is the actual loationof your MAMBO
index.php
where Itemid=## is your actual SMF component Itemid

so, an example, (as provided by goosemoose)
Code: [Select]
UPDATE rfc_messages SET `body` = replace(`body`,"http://www.goosemoose.com/rfc/index.php?topic=","http://www.goosemoose.com/index.php?option=com_smf&Itemid=70&")

He used rfc_ as his SMF database table prefix and rfc was the SMF directory.
note that his mambo is installed in the root directory...

« Last Edit: March 24, 2006, 10:37:05 AM by Kindred »
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline Kindred

  • The Mean One
  • Local Moderator
  • SMF Legend
  • *
  • Posts: 51,429
  • Gender: Male
    • Kindred-999 on GitHub
OTHER MODULES/BOTS:
« Reply #2 on: May 17, 2005, 08:15:10 PM »
OTHER MODULES/BOTS:

MOSBOT

There is a Mambot utility that allows a "discussion link" to be inserted
into Mambo/Joomla News items.
This link will create a new topic, if one does not already exist. If a topic linked
to this News item does exist,
the link will add a reply from the current user.
Chadness has taken over most of the work on this Bot, HERE

SEARCHBOT
This Bot will add SMF locations into your standard Mambo/Joomla search function.
RJPrince has made an excellent utility, available HERE.
A searchbot to integrate the SMF forums into Mambo's general search feature. Be sure to read the readme file to make necessary changes to index.php.
also avilable by link at the Princeclan site

MISCELLANEOUS MODULES

There are various modules that use SSI functions to display SMF
information in the Mambo/Joomla framework.
These can all be loaded directly into Mambo Admin > Modules > Install/Uninstall Modules.
or Jooma Admin > Install/Uninstall > Modules

mod_related_topics:
   This module displays links to SMF topics that are related to the Item currently displayed.
   These are based on the keywords Metadata. All the keywords of the current Content Item are
   searched against the titles of topics. For example, you may have an Item on 'Breeding Cockatoos'
   and you may have a discussion entitled 'Hand Raising Parrots'. If you include the keyword
   'parrot' in the Metadata of the item, then the Related Topics module will list the
   'Hand Raising Parrots' Topic when viewing 'Breeding Cockatoos'.

mod_smf_RecentEvents:
   This module uses the SSI function to display the Upcoming (5 days) Events, in a simple list.

mod_smf_RecentPosts:
   This module uses the SSI function to display the last 5 posts made in the SMF Forum.

mod_smf_RecentTopics:
   This module uses the SSI function to display the last 5 Topics posted in the SMF Forum.

mod_smf_topTopicsReplies.zip
   This module uses the SSI function to display the top 5 Topics posted to in the SMF Forum.

mod_smf_whosOnline
   This module uses the SSI function to display the users currently online.
   (The Mambo Who's Online module is buggy when working with the bridge. This file
   actually is also a bit buggy...  I recommend using the online2 module listed next)

mod_smf_online2.zip
   This module has been modified by Kindred and then spruced up (alot) by mic. Mic has
   done a great job and there are many parameters you can set to get the display that
   you want. This, by default, displays the number of Guests and Users online and then
   a bulleted list of the users. The exact text, and the format of the list of users
   (bulleted or comma separated) is defined in the module configuration.
   The file included with the bridge has some errors in it, relating to Hidden Users.
   You can get a fixed copy at My site

mod_smf_topPosters.zip
  This module has been designed from the original SSI function by Kindred. It will list
  the top X posters along with their current post count (all defineable as parameters)

mod_smf_events.zip
  This module has been modified from the original SSI function by Kindred. It will list
  (configurable) the holidays, birthdays and events form the SMF calendar.

mod_smf_showcal.zip
  This module has been modified from White Rabbit's original attempt at the bridge
  and SSI functions by Kindred. It is fairly configurable and will show the SMF calendar
  in minitaure, to fir in the module (usually side-bar) space. A mouse-over of days with
  events will show a pop-up with the event, holiday and/or birthday information from
  the SMF calendar.

mod_smf_keystats2.zip
  This module by xenovanis displays certain statistics about your SMF forum. It
  is available HERE.
« Last Edit: January 09, 2006, 08:19:25 AM by Kindred »
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline Kindred

  • The Mean One
  • Local Moderator
  • SMF Legend
  • *
  • Posts: 51,429
  • Gender: Male
    • Kindred-999 on GitHub
ADDITIONAL CODE HACKS:
« Reply #3 on: July 26, 2005, 10:45:22 AM »
ADDITIONAL CODE HACKS:

In additon to the SearchBot, bmwheaven has come up with a way to add specific buttons for searching SMF and Coppermine into your Mambo/Joomla search page

To add a search function of SMF (and Coppermine) to your mambo search box, check out
THIS thread by bmwheaven



to add the coppermine link to your user's posts (or anywhere else) and still open it
wrapped in mambo, check out THIS thread by Goosemoose



From Goosemoose, if you add this line into the code that you added in your mambo/joomla template file (just after the switch to the mosConfig_db), it will add dynamic page titles for your forum pages.

Code: [Select]
if(!empty($context['page_title']))
     $mainframe->setPageTitle($context['page_title']);


Dynamic page titles in your wrapped forum, and your Mambo content items, can also (theoretically) be accomplished like this:
(If your mambo template does not have a title tag, that is because it is being called in the mos_header code... and this hack will not work)

1)  Move the bridge include code above your <title> tag in your Mambo template. (Just cut and paste).

2)  Change the code from <title> to </title> (inclusive) to this:

Code: [Select]
<title><?php 

  
if ($_REQUEST[&#39;id&#39;]) {
  // load the content item name and category
    $database->setQuery"SELECT title, catid FROM #__content WHERE id=$id);
    $row null;
    $database->loadObject$row );
  }

echo 
$context[&#39;page_title&#39;] ? $context[&#39;page_title&#39;] : ($row->title ? $row->title : $mosConfig_site_name); ?>
</title>


RJPrince, who wrote the original hack has noted that v3.20 of the Bridge breaks the previous hack for the pathways (see below).
He has worked out that adding this code to the Joomla template's index.php file (just below the opening body tag) should work.

Code: [Select]
<?php
/************************Below Added to use Mambo Pathway *********************/
global $mainframe;

// Get last item.
end($context[&#39;linktree&#39;]);
$last_link_key key($context[&#39;linktree&#39;]);

foreach ($context[&#39;linktree&#39;] as $link_num => $tree)
{
if ($link_num 0) { // Don&#39;t show first linktree element, because forum menu item will already be in Mambo Pathway.
//If there is a url and this is not the last link item, show as a link. Otherwise just show.
$mainframe->appendPathWay(((isset($tree[&#39;url&#39;]) && ($last_link_key != $link_num)) ? 
 ob_mambofix(&#39;<a href="&#39; . $tree[&#39;url&#39;] . &#39;" class="pathway">&#39;) . $tree[&#39;name&#39;] . &#39;</a>&#39; : $tree[&#39;name&#39;]) . &#39; &#39;);
}
}
/************************Above Added to use Mambo Pathway *********************/
?>




This is the previous hack from RJPrince and should work with version 3.19a of the bridge....

Adding this code to components/com_smf/smf.php just above the function declaration for function ob_mambofix($buffer) seems to work to add the SMF location into the "pathway" line-item in the mambo template:


Code: [Select]
/************************Below Added to use Mambo Pathway *********************/
global $context, $mainframe;

// Get last item.
end($context['linktree']);
$last_link_key = key($context['linktree']);

foreach ($context['linktree'] as $link_num => $tree)
{
if ($link_num > 0) { // Don't show first linktree element, because forum menu item will already be in Mambo Pathway.
//If there is a url and this is not the last link item, show as a link. Otherwise just show.
$mainframe->appendPathWay(((isset($tree['url']) && ($last_link_key != $link_num)) ?
ob_mambofix('<a href="' . $tree['url'] . '" class="pathway">') . $tree['name'] . '</a>' : $tree['name']) . ' ');
}
}
/************************Above Added to use Mambo Pathway *********************/



Inserting the code below into index.template.php will redirect any users who access the forum URL directly into the joomla/mambo wrapped forum URL.
Orstio made the original hack andf exrace modified it...

Code: [Select]
// Redirect users who try to access /forum directly
if (strpos($_SERVER['QUERY_STRING'], 'dlattach') === false)
{
        if(!defined('_VALID_MOS')){ header("Location: /index.php?option=com_smf&Itemid=yourItemidNum");}
}

This way if you change your url or use multiple names for your site it won't redirect them to a hardcoded name on the redirect.





GooseMoose has come up with another amazing hack.
This one allows you to run multiple forums (with completely separate message boards) sharing the same mambo/Joomla login. In other words, access to the site gives you access to all the separate forums.
CODE HACK AND DISCUSSION
« Last Edit: March 06, 2006, 08:31:40 AM by Kindred »
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline Kindred

  • The Mean One
  • Local Moderator
  • SMF Legend
  • *
  • Posts: 51,429
  • Gender: Male
    • Kindred-999 on GitHub
Code being stripped from posts?
« Reply #4 on: September 14, 2005, 08:54:05 PM »
This first hack is for Mambo 4.5.2.3 or prior ONLY. It will not work with Mambo 4.5.3 or any version of Joomla. See the second half of this message for Mambo 4.53 and Joomla.

If HTML code is being removed from posts in your wrapped forum, then you can try the following...


For a quick fix, you can do this:

In your Mambo includes folder, there is a file called mambo.php.  In it there is a function called mosGetParam().

Find this:

Code: [Select]
function mosGetParam( &$arr, $name, $def=null, $mask=0 ) {
$return = null;
if (isset( $arr[$name] )) {
if (is_string( $arr[$name] )) {
if (!($mask&_MOS_NOTRIM)) {
$arr[$name] = trim( $arr[$name] );
}
if (!($mask&_MOS_ALLOWHTML)) {
$arr[$name] = strip_tags( $arr[$name] );
}
if (!get_magic_quotes_gpc()) {
$arr[$name] = addslashes( $arr[$name] );
}
}
return $arr[$name];
} else {
return $def;
}
}

and replace with this:

Code: [Select]
function mosGetParam( &$arr, $name, $def=null, $mask=0 ) {
$return = null;
if (isset( $arr[$name] )) {
if (is_string( $arr[$name] )) {
if (!($mask&_MOS_NOTRIM)) {
$arr[$name] = trim( $arr[$name] );
}
if (!defined("_MOS_ALLOWHTML")) {
$arr[$name] = strip_tags( $arr[$name] );
}
if (!get_magic_quotes_gpc()) {
$arr[$name] = addslashes( $arr[$name] );
}
}
return $arr[$name];
} else {
return $def;
}
}





This secondhack is for Joomla ONLY. It will not work with Mambo 4.5.2.3 or previous. See the first half of this message for Mambo 4.5.2.3 and prior.

In your Joomla index.php, you can swap these two lines (~138-139):

Code: [Select]
$message = mosGetParam( $_POST, 'message', 0 );
if ($option == 'login') {

Altered code:

Code: [Select]
if ($option == 'login') {
     $message = mosGetParam( $_POST, 'message', 0 );




*Note that this is NOT a change recommended for everyone. Modifying core files is not typically required for the installation.)
« Last Edit: January 04, 2006, 08:01:56 PM by Kindred »
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline Kindred

  • The Mean One
  • Local Moderator
  • SMF Legend
  • *
  • Posts: 51,429
  • Gender: Male
    • Kindred-999 on GitHub
Instructions for Bridge v3.19a (1 of 2)
« Reply #5 on: January 04, 2006, 02:28:38 PM »
Instructions for v3.19a of the Bridge:  (for use with SMF 1.0.x and SMF 1.1RC1 or prior)
For SMF1.1 RC2, please use the bridge v1.1.1 (aka 3.20) and see the instructions higher in this thread.




This readme includes a step by step instruction on how to install the bridge.
It addresses the most common questions in slightly more detail than Orstio's separate files and it basically puts a description of everything in one place.

Of course, the first rule of software applies to the bridge, as everything else...   RTFM!

PLEASE NOTE:  There are now TWO versions of the bridge.
The one MOS_SMF_BRIDGEv3.19a_stable.zip is for use with SMF 1.0.5.
The one titled MOS_SMF_BRIDGEv3.19a_SMF1.1b3.zip is for use with SMF 1.1 beta3, beta 4 and RC1.
These bridges will NOT work with the other version! Please make sure you are using the correct bridge before attempting an installation!


This one is for SMF 1.0.x:

http://mamboforge.net/frs/download.php/6472/MOS_SMF_BRIDGEv3.19a_stable.zip

This one is for SMF 1.1 beta 3, beta 4 and RC1:

http://mamboforge.net/frs/download.php/6471/MOS_SMF_BRIDGEv3.19a_SMF1.1b3.zip

It should be noted that you can not have more than one menu link directly to the component smf- forums.
If you create more than one menu link (to the component) , it will cause mambo to create multiple ItemIDs that point to the same function. This will cause the bridge to have Multiple Personality Disorder...  and will mean that login/logout (among other things) will not work!

If you want to have the forum listed in multiple menus (like main and top, for example) then create ONE Component menu item (I suggest in Main) and then the other menu itmes should be LINK - URLs pointing to index.php?option=com_smf&Itemid=** (where ** is the actual ItemID on your system).

=================================================================================================
JOOMLA 1.0 - SMF 1.1 RC1 UPDATE

Joomla has apparently added a sessioncookiename...  this will prevent you from using the bridge and logging into both joomla and SMF.
Thanks to Elephants Gerald for figuring this out...
If you applied the HACK from Elephants Gerald, you will want to add the line back into joomla.php and do thge following code change from Orstio in MOS_SMF.php instead.

In MOS_SMF.php, we need to end the old Joomla session.  Because the name of the session cookie changed in Joomla, we need to change the code a bit:

Find (for login and logout functions...):

Code: [Select]
setcookie ("sessioncookie","",-3600, "/" );
Replace with:

Code: [Select]
    $sessionCookieName = md5( 'site'.$GLOBALS['mosConfig_live_site'] );
setcookie ($sessionCookieName,"",-3600, "/" );

==================================================================================================

ADDITIONAL FUNCTIONS:

To add a search function of SMF (and Coppermine) to your mambo search box, check out
THIS thread by bmwheaven

to add the coppermine link to your user's posts (or anywhere else) and still open it
wrapped in mambo, check out THIS thread by Goosemoose

From Gianni_T, this will add the dynamic page titles...
Add the following command into "components/com_smf/smf.php" at line 36
Code: [Select]
$mainframe->SetPageTitle( $context['page_title'] );
« Last Edit: March 06, 2006, 08:32:59 AM by Kindred »
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline Kindred

  • The Mean One
  • Local Moderator
  • SMF Legend
  • *
  • Posts: 51,429
  • Gender: Male
    • Kindred-999 on GitHub
Instructions for Bridge v3.19a (2 of 2)
« Reply #6 on: January 04, 2006, 03:17:55 PM »
Instructions for v3.19a of the Bridge:  (for use with SMF 1.0.x and SMF 1.1RC1 or prior)
For SMF1.1 RC2, please use the bridge v1.1.1 (aka 3.20) and see the instructions higher in this thread.

It should be noted, before you start with this bridge...
Everything in these instructions assumes that you already have Mambo (4.5.1 or 4.5.2) or Joomla v1.0.5 or prior installed
and SMF (1.0.1, 1.0.2, 1.0.3, 1.0.4, or 1.0.5) (and 1.1 beta3, 1.1 beta 4 is now supported with a separate version of Orstio's Bridge) installed and both are working as stand-alone utilities.
NOTE: Mambo 4.5.3 changes things! v3.19a of the bridge is not intended to work with the 4.5.3

For simplicity, if you don't know exactly what you are doing:
- SMF should be installed in a "top level" directory. (i.e. www.yoursite.com/forum or
something like that)
- Mambo can be installed in a "top level" directory or at the top level itself.

to get the bridge, go to:
http://mamboforge.net/frs/?group_id=543

START:

First, unzip the Bridge ZIP file

This will extract to create a number of subdirectories and files.
step-by-step install
misc modules
mosbot

It should be noted that these instructions assume that you have never had the bridge
installed before. If you have had the bridge previously installed, some steps may
already have been done, or may fail with the automatic installs, since the code they
are looking to modfy has already been modified. For upgrade details, I have made a
separate section of these instructions.

INSTALLATION INSTRUCTIONS:

Now that you have all the files unzipped and ready to load, you can log in to your
server and start installation.

This README has a detailed instructions, but the new step-by-step design makes things
fairly easy and straight-forward. Make sure you read all the README files in each of
the directories.


1) Install the package in SMF.
      1a) Using your (standalone) SMF, go to the package manager
      1b) Choose Download a new Package
      1c) From the the "step-by-step install/step 1" directory, upload
            "smf_mambo3.1.tar.gz" and apply the mod.

2) Install the Simple Machines Forum component.
      2a) Using Mambo Admin > Components > Install/Uninstall Component
      2b) Choose Upload File Package and Browse to the "step-by-step install/step 2"
            directory and choose the file called "com_smf.zip"

3) Install the Simple Machine Forum Registration component.
      3a) Using Mambo Admin > Components > Install/Uninstall Component
      3b) Choose Upload File Package and Browse to the "step-by-step install/step 3"
            directory and choose the file called "com_smf_registration.zip"
 
         This uses the registration options in your Mambo Admin > Global Configuration,
         just like the Mambo default registration.

4) Install the smf_login Module.
      4a) Using Mambo Admin > Modules > Install/Uninstall Module
      4b) Choose Upload File Package and Browse to the "step-by-step install/step 4"
            directory and choose the file called "mod_smf_login.zip"
 
5) Modify the index.php of your Mambo Template.
      5a) Go to directory MAMBO/templates/NAME (where MAMBO is your mambo directory and
            NAME is the name of the template.)
      5b) Open index.php
      5c) Add the following code just before the </HEAD> tag in index.php

Code: [Select]
<?php 
global $sc$context;

if (!
defined(&#39;SMF&#39;)){
  require ("administrator/components/com_smf/config.smf.php");
  require ($smf_path."/SSI.php");
}

$sc = &$context[&#39;session_id&#39;];
$_SESSION[&#39;USER_AGENT&#39;] = $_SERVER[&#39;HTTP_USER_AGENT&#39;];

mysql_select_db($mosConfig_db);
?>

AND add the following just above the </body> tag:
Code: [Select]
<?php mysql_select_db($db_name); ?>

6) Configure the SMF component in Mambo Admin.
      6a) Using the Mambo Admin, choose Components> Simple Machines Forum > Edit Config
      6b) Set the Path to SMF. This is NOT a URL! This is the absolute path to your SMF
            Installation.
            (Usually this will be something similar to /home/username/public_html/forum)
      6c) Choose if you want your Forum wrapped or unwrapped.
 
         It should be noted that there are essentially three formats to display your
         Mambo/Forum integration:
      Wrapped:         You are using SMF through the Mambo bridge. The Forum appears
                           "wrapped" in the Mambo tables.
      Unwrapped:      You are still using SMF through Mambo, but it doesn't have the
                           look of a wrapped forum. It looks stand-alone, but it is actually
                           loading through Mambo.
                           This is set in the Mambo config for the component.
                           (The changes to MOS_SMF.php are not required in this case.)
      Stand-alone:   You don't want your forum URL to change.
                           This would be if you already have a large SMF userbase, and you
                           don't want them to have to change the URL that they probably have
                           bookmarked.  In that case, make the changes in MOS_SMF.php as noted.
      7d) Choose if you want to use the bridge registration or the standard SMF registration.
         The bridge registration looks like mambo's registration method...
         but both options will still result in the users being added to both databases (eventually).

7 ) Other Configuration notes
      7a) You will probably want to start SMF off with default settings...
      7b) If you make the Mambo menu item (for the SMF component) available to registered
            users only, the login and registration may not function correctly.
      7c) Activation emails should be handled by Mambo.

8) in Mambo Admin > Modules > Site Modules: Unpublish the (default Mambo) mod_login module.

9) in Mambo Admin > Modules > Site Modules: Edit the mod_smf_login module.
         It is a known issue in Mambo that modules must be "saved" at least once in order to
         be fully activated.
      10a) Choose what options you want displayed in your Login box...

10) In Mambo Admin > Menu > User Menu Remove the link for the User Profile.
      (You will not want Mambo to handle the user information any more)

11) In Mambo Admin > Site > Trash Manager: Click on the Menu Items tab and delete all
the trashed items... (this cleans up the ItemID stuff. If you ever uninstall your smf
bridge, you will want to delete the old menu item and remove the trash before adding
a new version of the bridge. Otherwise Mambo may get confused as to which ItemID the
real bridge is using.)



THEMING:

Changing the SMF doc_type from xhtml to html will handle many of the basic "super
large font" issues.
The can be done by changing the line near the top of index.template.php in your SMF
Theme directory.
However, some of the Mambo templates and SMF themes do not play well together.

In the Mambo Template, fixed width templates of less than 500 pixels width are
difficult for SMF to "fit in".
You have two main options.
The first is to increase the basic width of the Mambo Template.
-> In MAMBO/templates/TEMPLATE_NAME/index.php, change the width call of the main
table to something larger...

The second option, which may require some tweaking, is the change the Mambo Template
into a variable width template.
-> In MAMBO/templates/TEMPLATE_NAME/index.php, change the width call of the main
table 100%...

In addition to the width issues, there are some overlaps in the CSS entires between
Mambo and SMF.
The CSS files for Mambo and SMF have some duplicate values that may conflict.
A proper design of the bridged site will include personalized templates/themes for
Mambo and SMF that
will avoid this situation. This may take some time (and effort), however. You can
make a "quick and dirty"
merge of the CSS files by doing the following:

Open the MAMBO/templates/TEMPLATE_NAME/css/template_css.css file
Open the SMF/Themes/THEME_NAME/style.css file

Copy all of the SMF Theme file into the Mambo template file.
Remove the Duplicate entries from the newly copied portion.
(In other words, if the CSS entry exists in the Mambo template, delete the entry in
the newly created SMF section)
Now save it, and then remove the same "duplicate" entries in the style.css file in
your SMF theme directory.

FIXING LINKS IN SMF MESSAGES FROM PRE-BRIDGED FORUMS

(thanks to goosemoose for this)
If you were running a forum prior to bridging it with mambo, there will be links in
messages that point to the unbridged forum location. You can change these by going
into phpMyAdmin and running a simple SQL command on the smf_messages table.

The format is:
Code: [Select]
UPDATE smf_messages SET `body` = replace(`body`,"http://www.yoursite.com/forum/index.php?topic=","http://www.yoursite.com/mambo/index.php?option=com_smf&Itemid=##&topic=")

where smf_messages is your actual table (change the smf_ if you are using a different
prefix, obviously)
where http://www.yoursite.com/forum/index.php is the actual URL of your previous
(unbridged) SMF index.php.
where http://www.yoursite.com/mambo/index.php is the actual loationof your MAMBO
index.php
where Itemid=## is your actual SMF component Itemid

so, an example, (as provided by goosemoose)
Code: [Select]
UPDATE rfc_messages SET `body` = replace(`body`,"http://www.goosemoose.com/rfc/index.php?topic=","http://www.goosemoose.com/index.php?option=com_smf&Itemid=70&topic=")

He used rfc_ as his SMF database table prefix and rfc was the SMF directory.
note that his mambo is installed in the root directory...

USING THE BRDIGE WITH NO GUEST ACCESS TO YOUR FORUM
To get the best functionality, you should have your forum available to guests (one section is all that is required).
If, for some reason, you feel that guest viewing of your forum should not be allowed, at all, then you can try the following fix.

In SMF's index.php, find the guest access "whitelist" (things guests are allowed to do) and add mambo_login, as suggested below.
Code: [Select]
// If guest access is off, a guest can only do one of the very few following actions.
elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('login', 'login2', 'mambo_login', 'register', 'register2', 'reminder', 'activate', 'help', '.xml'))))

UPGRADING THE BRIDGE

If you are upgrading, and just want to over-write the files, the new version (3.1)
adds a number of files that did not exist pre-3.0.

These go into administrator/components/com_smf/:

admin.smf.php
config.smf.php
install.smf.php
smf.xml
toolbar.smf.html.php
toolbar.smf.php
uninstall.smf.php

These goes in components/com_smf/:

smf.php
the entire language/ directory and all files in it

These goes in administrator/components/com_smf_registration/:

admin.smf_registration.php
config.smf_registration.php
install.smf_registration.php
smf_registration.xml
toolbar.smf_registration.html.php
toolbar.smf_registration.php
uninstall.smf_registration.php

These goes into components/com_smf_registration/:

smf_registration.php
smf_registration.html.php

This goes into your SMF /Sources/:

MOS_SMF.php

« Last Edit: February 10, 2006, 06:17:04 PM by Kindred »
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline Kindred

  • The Mean One
  • Local Moderator
  • SMF Legend
  • *
  • Posts: 51,429
  • Gender: Male
    • Kindred-999 on GitHub
Themes.template.php width issues...
« Reply #7 on: January 09, 2006, 08:40:40 AM »
If you are having troubles with the width of the theme setup page in any version of SMF 1.1 while it is wrapped:

In the core theme, in Themes.template.php, find this (3 instances, on lines 100, 108, and 117):

Code: [Select]
<td style="padding-left: 20%;">
replace with this:

Code: [Select]
<td style="padding-left: 20ex;">
« Last Edit: April 08, 2006, 01:07:19 AM by Kindred »
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline Kindred

  • The Mean One
  • Local Moderator
  • SMF Legend
  • *
  • Posts: 51,429
  • Gender: Male
    • Kindred-999 on GitHub
Error message '8: Undefined index: sa
« Reply #8 on: January 21, 2006, 10:11:35 AM »
Apparently, some servers don't like line 497 in smf.php.
They return lots of error messages like this, in your SMF error log.


Error message '8: Undefined index: sa
File: /home/..../joomla/components/com_smf/smf.php
Line: 497'


Line 497 in smf.php is:

if (substr($setLocation, 0, 4) == 'http' && $_REQUEST['action'] != 'logout' && $_REQUEST['sa'] != 'check')

To fix this, according to Orstio, change this line to read:


if (substr($setLocation, 0, 4) == 'http' && $_REQUEST['action'] != 'logout' && (!isset($_REQUEST['sa']) || $_REQUEST['sa'] != 'check'))


« Last Edit: February 06, 2006, 10:30:05 AM by Kindred »
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Orstio

  • Guest
Re: SMF <-> Mambo/Joomla Bridge (Combined Readme)
« Reply #9 on: January 21, 2006, 10:14:57 AM »
That will be fixed in the next revision, along with a few others.

Offline Kindred

  • The Mean One
  • Local Moderator
  • SMF Legend
  • *
  • Posts: 51,429
  • Gender: Male
    • Kindred-999 on GitHub
Other Modules ... formerly included with the bridge package
« Reply #10 on: January 31, 2006, 02:26:13 PM »
attached are modules that were formerly included with the bridge package.

I don't think the related topics module works under SMF 1.1 RC2... but the rest should work correctly under any version of SMF and any version of Mambo or Joomla.
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline Kindred

  • The Mean One
  • Local Moderator
  • SMF Legend
  • *
  • Posts: 51,429
  • Gender: Male
    • Kindred-999 on GitHub
Joomla 1.0.8 login issues with bridge v1.1.2?
« Reply #11 on: March 06, 2006, 08:26:43 AM »
This fix from Predator (one of the Joomla people) is for correcting v1.1.2 (aka 3.20) to work with the new login structure of Joomla 1.0.8.

In joomla/components/com_smf/smf.php, find this in the integrate_login function:

components/com_smf/smf.php starting at line 443 ( function integrate_login):

Code: [Select]
$lifetime = time() + (60 * $cookielength);

//Let's make sure this works in both Mambo and Joomla
$sessionCookieName = md5('site' . $mosConfig_live_site);
setcookie($sessionCookieName, '', -3600, '/');

Add after this:

Code: [Select]
// For Joomla 1.0.8 compatibility
global $_VERSION;

if (isset($_VERSION) && $_VERSION->DEV_LEVEL >= '8'){
$remCookieName = mosMainFrame::remCookieName_User();
$remCookieValue = mosMainFrame::remCookieValue_User( $username ) . mosMainFrame::remCookieValue_Pass( $passwd );
setcookie( $remCookieName, $remCookieValue, $lifetime, '/' );
}


and function integrate_logout at the top of the function:

Code: [Select]
setcookie('usercookie[username]', $username, time() - 3600, '/');
setcookie('usercookie[password]', '', time() - 3600, '/');
setcookie('sessioncookie' , '' , time() - 3600 , '/');

//Let's make sure this works in both Mambo and Joomla
$sessionCookieName = md5('site' . $mosConfig_live_site);
setcookie($sessionCookieName, '', time() - 3600, '/');

Add after this:

Code: [Select]
//For Joomla 1.0.8 compatibility
global $_VERSION;

if (isset($_VERSION) && $_VERSION->DEV_LEVEL >= '8'){
         $lifetime = time() - 86400;
         $remCookieName = mosMainFrame::remCookieName_User();
         setcookie( $remCookieName, ' ', $lifetime, '/' );
}
« Last Edit: March 06, 2006, 09:47:00 PM by Kindred »
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.

Offline Kindred

  • The Mean One
  • Local Moderator
  • SMF Legend
  • *
  • Posts: 51,429
  • Gender: Male
    • Kindred-999 on GitHub
Fix for Joomla 1.0.8 and bridge v3.19 (for SMF 1.0.x or 1.1b3)
« Reply #12 on: March 07, 2006, 08:38:03 AM »
ElephantsGerald has come up with a similar hack for previous versions of the bridge to allow it to continue working/login/logout with Joomla 1.0.8.

For those using SMF 1.0.6, Joomla 1.0.8 and the Orstio bridge 3.19, I've managed to get a result by working from Predators code.

The file you need to update is: /forum/Sources/MOS_SMF.php (where 'forum' is the directory you've installed SMF to).

Find the first instance of the following line (somewhere aound line 320):
Code: [Select]
$sessionCookieName = md5( 'site'.$GLOBALS['mosConfig_live_site'] );
setcookie ($sessionCookieName,"",-3600, "/" );
(N.B. my version of MOS_SMF.php has already been hacked once for previous changes to Joomla authentication - you may need to look for (and change) the original version of the above code, which looked like this:
Code: [Select]
setcookie ("sessioncookie","",-3600,"/");)

Add the following code afterwards
Code: [Select]
// For Joomla 1.0.8 compatibility
global $_VERSION;

if (isset($_VERSION) && $_VERSION->DEV_LEVEL >= '8'){
$remCookieName = mosMainFrame::remCookieName_User();
$remCookieValue = mosMainFrame::remCookieValue_User( $username ) . mosMainFrame::remCookieValue_Pass( $passwd );
setcookie( $remCookieName, $remCookieValue, $lifetime, '/' );
}


Now find the second instance of the following line (somewhere aound line 380):
Code: [Select]
$sessionCookieName = md5( 'site'.$GLOBALS['mosConfig_live_site'] );
setcookie ($sessionCookieName,"",-3600, "/" );

Add the following code after:
Code: [Select]
if (isset($_VERSION) && $_VERSION->DEV_LEVEL >= '8'){
         $lifetime = time() - 86400;
         $remCookieName = mosMainFrame::remCookieName_User();
         setcookie( $remCookieName, ' ', $lifetime, '/' );
}

I hope this makes sense.....
Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support forums.  Thank you.