SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Share user database for 2 (or more) different forums.

Started by Spaceman-Spiff, September 03, 2004, 09:14:44 PM

Previous topic - Next topic


God of Ikiliki

How do I get the same forum stats and be possible to move a topic to another forum?


When I post, I get this error;

Fatal error: template_main() [function.require]: Failed opening required '/home/ageofgam/public_html/ts/Sources/CustomProfile.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/ageofgam/public_html/ts/Sources/Load.php(1730) : eval()'d code on line 333



Did you manage to fix this?
That error probably appears because the file is not there, or it's not chmodded correctly.


guys could someoen PLEASE help me beofre i pull my hair out.

Ok, ive already got a forum on my domain at

Ive also freshly installed a new forum at

(both folders are obviously on the same domain.

The databases are smf_1 for 'forum2' and smf-2 for 'postmolar' forums

"The old forum has loads of memebrs etc and quit a few mods on it which ive had to install freshly onto the new forum (postmolar). So basically my new forum now has 1 admin member (me) and nobody else.

So, Ive FTP'd all the files in the 'sources' directory off of my forum2 folder to my hard drive and then using ultaedit ive found and replaced the following

{$db_prefix}members" and replace with "smf1_members"

{$db_prefix}membergroups" and replace with "smf1_members"

both of these obviously without quotes.

So, in theory once ive saved all the replaced files and stuff it should work once ive uploaded them all.

However when i try to log into the new forum (postmolar) with a username that i have on the old forum (forum2) it doesnt work.

All i get is an error in SMF which says Database error, if you get this again please let the administrator know.

Or words to that effect.

So, what am i doign wrong please? I'm at a loss.

All im trying to do is to stop people having to sign up for my newforum and let them use there old username and password for the old forum (which will still also be useable)



where do you replace the smf_1 and smf_2 ?

What i would do in your place:

Use the settings.php to enter
after the orginal $db_prefix
put the $db_prefix2

It should look like this :
$db_prefix = "smf1"; <- points to new install = 1 member
$db_prefix2 = "smf2"; <- points to old install = all members

Then the heavy work starts
check ALL files where the forumsoftware uses {db_prefix}members
and change it to {db_prefix2}

i use this method by running 4 "language" forums where all forum posts
are seperated only the pm's and the member Db's are "shared"


hi mike, i think i get what you mean. So im just adding another line to the settings.php file? and that line goes directlly underneath the one line that says :-

$db_prefix = "smf1";

So i add (underneath that) :-

$db_prefix2 = "smf2";

So i end up with :-

$db_prefix = "smf1";
$db_prefix2 = "smf2"

Then i need to open up all the php files in the folder called "source' ?

P.S i use ultraedit for this becuae it can search whoel folders of php files are replace them words etc without having to open them all up.

Then i find all instances of :-


and change them all to:-


and thats it?

Whare is the file called settings.php then? in the root? or in the sources folder?

thanks for the reply :0)

P.S you asked where i replace fmf_1 and smf_2? if you look at the beginning of this thread there are the instructions i followed. I dont knwo where each instance is becuae i used ultraedit to find them all so i never actually opened the php files just does it for me lol


P.S Ive opened up settings.php in the route on my forum and this is it. theres no mention of $db_prefix = "smf1"

I do however have the folowing line in that code :-

$db_prefix = 'smf_';

But im unsure what to do now as there is no number after the underscore. Im confused ! :(

Heres my settings.php file :-

########## Maintenance ##########
# Note: If $maintenance is set to 2, the forum will be unusable!  Change it to 0 to fix it.
$maintenance = 0; # Set to 1 to enable Maintenance Mode, 2 to make the forum untouchable. (you'll have to make it 0 again manually!)
$mtitle = 'Maintenance Mode'; # Title for the Maintenance Mode message.
$mmessage = 'Hi There ! I am just in the process of adding some more \'emoticons\' for you all to use when you post messages. The site will be back up in around 10 mins. Sorry for any inconvenience caused. Thanks Darren (Admin)'; # Description of why the forum is in maintenance mode.

########## Forum Info ##########
$mbname = 'Molar Pregnancy Support Forum :: '; # The name of your forum.
$language = 'english'; # The default language file set for the forum.
$boardurl = ''; # URL to your forum's folder. (without the trailing /!)
$webmaster_email = '[email protected]'; # Email address to send emails from. (like [email protected].)
$cookiename = 'SMFCookie463'; # Name of the cookie to set for authentication.

########## Database Info ##########
$db_server = 'localhost';
$db_name = 'meisha1_smf1';
$db_user = 'meisha1_smf1';
$db_passwd = 'xxxxxxxxxxxx';
$db_prefix = 'smf_';
$db_persist = 0;
$db_error_send = 1;

########## Directories/Files ##########
# Note: These directories do not have to be changed unless you move things.
$boarddir = '/home/meisha1/public_html/forum2'; # The absolute path to the forum's folder. (not just '.'!)
$sourcedir = '/home/meisha1/public_html/forum2/Sources'; # Path to the Sources directory.

########## Error-Catching ##########
# Note: You shouldn't touch these settings.
$db_last_error = 1190982369;

# Make sure the paths are correct... at least try to fix them.
if (!file_exists($boarddir) && file_exists(dirname(__FILE__) . '/agreement.txt'))
$boarddir = dirname(__FILE__);
if (!file_exists($sourcedir) && file_exists($boarddir . '/Sources'))
$sourcedir = $boarddir . '/Sources';

$db_character_set = 'utf8';

Obvioulsy ive change the password and email to xxxxxxxx before i posted it on here but everything else is the same :)


Please look in the mod section for the shared forum mod.  There are 2 mods that do this one is for joomla, and one is stand alone. This thread should be killed as this is a very old method that probably does not work any more.


Hi goose,

IS that right? Isnt that mod one you created? Im sure i read elsewhere that it didnt actually do what i wanted it to do? I dont want to 'share a forum'.............i want to 'share a database' !

So will your mod do that? or the mod you refered to? If so then please point me in the direction by all means :)

Cheers for the reply

P.S How can this work if its 'stand alone'?


p.s i did a search for the word 'shared' in the mods section and it found nothing !


Hi Goose,

I foudn yoour mod thanks and laso the one that sarge has done using your code. BOTH are comlicated methods for someone liek myself mate. I know noithign about 'running code in phpmyadmin' etc etc.

It would be nice if someone coudl somehow just maek something that you uploaded by ftp and then went into an admin page and entred the parameteres rewuired or something.

(sigh) its so confusing is this mate.

Heres my FTP username and do it for me lol :)



I'm trying to do the same thing Dazlia is. I have goten most of it working using the suggestions in this thread, however there are still some bugs. One bug is that it only shows the same person logged in at all times and deosnt show when someone else logs in on the new forum. Also if I upload a custom avatar on one forum, it shows as a broken picture link in the other forum. I can change which one it shows up in by uploading my avatar in whichever forum I want it to show up in. I cant upload in both because once its done in one the ther forum seems to want to use that picture and it cant find it.
I also have a picture gallery in both forums. I dont want to share the pictures between forums. I have a problem though where if I upload a picture to the new gallery it shows as a broken link. I think it may be related to the "Users online" not working like I mentioned before because the one person that can post new pictures in the new gallery is the only guy who shows up as being online (he shows as always online, even when he is logged out).

I wish there could be an update to the SMF program to allow sharing a single member database that lets them use all the features on multiple forums, depending on which forums they are in at the time.


ok im pretty new to SMF but since noone else seems to wanna handle this mod i will look into getting hte new coding up for it. granted this is after i run it on my server and make sure what works and don't work. and considering i use 1.1.4 AND tinyportal 9.8.0 once i get done modifing the files that are needed. get the right codes for the updated versions. and make sure everything is working since goose refuses to help with THIS mod, and instead refers people to mods that aint exactly what they want.

for instance me i wanna share users, membergroups, between right now 2 forums; but, will become many more later down the road. i am very used to editing codes for phpbb, and like i said am new to SMF, so please people bear with me. i am just now starting with this mod. [nofollow] <- main site. <- website hosting. <- yahoo booter site.


ok so far i have had no problem sharing any database, it is working smothly cept for one tiny problem. when i log outta one forum i am staying logged in on another one. which table is it that handles being logged out? [nofollow] <- main site. <- website hosting. <- yahoo booter site.


I have two forums on two domains, I have used this thread to share the users and PMs.  It seems, from what I've read of the shared forum mod, that this is still the best solution for me, as I have two separate domains/URLs that I want people to hit for the forums.  Does this sound right?

Is there any way to share the avatars?  That's really the only issue I have right now.  I also can't make the cookie name the same, as they are on separate domains, so I don't share the sessions.



Here's how you get your avatars to show up on both/all forums when you share it by changing the {$dbprefix} per the tutorial:

Change your attachment and avatar directories to be the same on the new forum as they are on the original.  This will allow your shared user information profiles to continue looking in the same place regardless of forum.