Simple Machines Community Forum

Customizing SMF => Tips and Tricks => Topic started by: Spaceman-Spiff on September 03, 2004, 09:14:44 PM

Title: Share user database for 2 (or more) different forums.
Post by: Spaceman-Spiff on September 03, 2004, 09:14:44 PM
Someone asked me how to setup 2 different SMF forums with shared user database. So, instead of writing in private message, I decide to share it here. Besides, I have never tried this myself, so I could use the feedback in case the steps I outline below are wrong or incomplete.

In the tutorial below, the following database tables will be shared:You can share more tables if you like, and if you know what you're doing.

Here it goes...

1. Installing the forums
Install two (or more) different SMF forum in the same database, but using different prefix. For this example, the first forum is using "smf1_" (without quotes) and the second is using "smf2_". Just install the two forums normally, don't start telling users to sign up yet.


2. Modifying the source code
Open each of the .php files located in the Sources directory in your hard drive using a text editor program. Find all occurances of "{$db_prefix}members" and replace with "smf1_members" (without quotes). Do this for every single .php file in the Sources directory. Also find and replace the following:
"{$db_prefix}im_recipients" => "smf1_im_recipients"
"{$db_prefix}instant_messages" => "smf1_instant_messages"
"{$db_prefix}membergroups" => "smf1_membergroups"
You can also share more tables if you want and know what you're doing.

If you have a text editor program that can do batch replace or replace in all opened documents, use that instead, it will ease the task a lot (you can open everything at do a replace for all of the opened files). One text editor program that I know can do this is JCreator (http://www.jcreator.com/).


3. Upload the modified source files
Upload the content of the Sources directory that you just modified above to the Sources directory in your forum(s), overwrite any existing files. You don't need to do this for your first forum (smf1_), but doing this won't cause any problems.

Your forums should now share the same member, membergroup and instant message database.


4. Optional settings
If both (or all) of the forums are hosted on the same site (domain), you can use the same Cookie name for SMF, so users won't need to login twice when moving from one forum to another. You can find this setting inside the Admin Center -> Edit Server Settings -> Cookie Name


Possible Issues
Other recommended tables to share:
- log_karma
- log_online <- session might get screwed if the forums are in different domains


Any comments/suggestions/errors?
I keep on thinking I'm forgetting something here... ::)
Title: Re: Share user database for 2 (or more) different forums.
Post by: [Unknown] on September 03, 2004, 09:50:40 PM
I'd share the themes table too.

-[Unknown]
Title: Re: Share user database for 2 (or more) different forums.
Post by: nil on September 12, 2004, 12:48:39 AM
What if its in the format: ' . $db_prefix . '

Such as how do I change this line to point at smf_roster?
$qrycr = mysql_query('SELECT `membergroup`,`ACCTUSER` FROM ' . $db_prefix . 'roster WHERE ACCTUSER=\'' . $user_info[username] . '\'')

Thanks this will solve a huge problem on one of my forums!
Title: Re: Share user database for 2 (or more) different forums.
Post by: [Unknown] on September 12, 2004, 01:22:19 AM
Find:

$qrycr = mysql_query('SELECT `membergroup`,`ACCTUSER` FROM ' . $db_prefix . 'roster WHERE ACCTUSER=\'' . $user_info[username] . '\'');

Replace:

$qrycr = mysql_query('
SELECT membergroup, ACCTUSER
FROM smf_roster
WHERE ACCTUSER = \'' . $user_info['username'] . '\'');


-[Unknown]
Title: Re: Share user database for 2 (or more) different forums.
Post by: nil on September 12, 2004, 01:25:18 AM
thanks!
Title: Re: Share user database for 2 (or more) different forums.
Post by: Elijah Bliss on September 12, 2004, 04:53:52 PM
What if the second forum is located on another server?
Title: Re: Share user database for 2 (or more) different forums.
Post by: [Unknown] on September 12, 2004, 05:35:10 PM
Quote from: Elijah Bliss on September 12, 2004, 04:53:52 PM
What if the second forum is located on another server?

Then it's nearly impossible... or you could just use one MySQL server still, but it would be horridly slow.

-[Unknown]
Title: Re: Share user database for 2 (or more) different forums.
Post by: Spaceman-Spiff on September 21, 2004, 01:48:17 AM
I didn't realize some queries use single quotes instead of double...

Quote from: Elijah Bliss on September 12, 2004, 04:53:52 PM
What if the second forum is located on another server?
Usually webhosts don't allow remote database access. But if you own the server yourself, you can try to configure it to allow remote access.
Title: Re: Share user database for 2 (or more) different forums.
Post by: [Unknown] on September 21, 2004, 02:03:00 AM
Quote from: [Unknown] on September 12, 2004, 01:22:19 AM
$qrycr = mysql_query('
SELECT membergroup, ACCTUSER
FROM smf_roster
WHERE ACCTUSER = \'' . $user_info['username'] . '\'');


Quote from: Spaceman-Spiff on September 21, 2004, 01:48:17 AM
I didn't realize some queries use single quotes instead of double...

None do currently in the SMF code base, that query is not from SMF.

-[Unknown]
Title: Re: Share user database for 2 (or more) different forums.
Post by: Nic on October 26, 2004, 11:41:05 AM
Firstly, thanks SO much for this post - it was exactly what I needed.  I now have two forums for two sub-domains on the same site using one member table, which is just what I wanted.  however, I did notice one thing (no biggy, but wondered if I could fix it).  If someone registers on one forum, the member count automatically adds another one on, but on the other forum it doesn't and I have to tell it to recount the totals.  it's not a big hassle at the moment, since both forums are just new and not many people are registering, but if the forums get bigger it could be annoying having to recount totals each time a new member joins.  Is there any way around this?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Anguz on October 29, 2004, 09:30:40 PM
http://mods.simplemachines.org/index.php?mod=41 ;)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Nic on October 31, 2004, 05:17:25 AM
Hi, Anguz.  That's more or less what I have done with my board, but it still won't tally the members on the second board if they register on the first, or vice versa...
Title: Re: Share user database for 2 (or more) different forums.
Post by: [Unknown] on October 31, 2004, 05:41:46 AM
Find, Sources/Subs.php:

updateSettings(array(
'latestMember' => $latestmember,
'latestRealName' => $latestRealName,
'memberCount' => $memberCount,
'unapprovedMembers' => $unapprovedCount
));


Replace:
db_query("
REPLACE INTO prefix1_settings
VALUES ('latestMember', '$latestmember'),
('latestRealName', '$latestRealName'),
('memberCount', '$memberCount'),
('unapprovedMembers', '$unapprovedCount')", __FILE__, __LINE__);

db_query("
REPLACE INTO prefix2_settings
VALUES ('latestMember', '$latestmember'),
('latestRealName', '$latestRealName'),
('memberCount', '$memberCount'),
('unapprovedMembers', '$unapprovedCount')", __FILE__, __LINE__);


-[Unknown]
Title: Re: Share user database for 2 (or more) different forums.
Post by: Anguz on October 31, 2004, 05:44:22 AM
Quote from: Nic on October 31, 2004, 05:17:25 AM
Hi, Anguz. That's more or less what I have done with my board, but it still won't tally the members on the second board if they register on the first, or vice versa...

That'd be because that information is saved in the settings table.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Nic on October 31, 2004, 06:28:46 AM
Thanks both of you.  Just what I needed [Unknown].  I had looked at that bit before but couldn't for the life of me figure out what to change it to.  It's now working perfectly :)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Anguz on October 31, 2004, 02:00:11 PM
Heh, I didn't see [Unknown]'s reply when I posted mine last night. We did it at the same time.
Title: Re: Share user database for 2 (or more) different forums.
Post by: jamesgrant on November 02, 2004, 04:26:10 PM
hello....


I've just added another forum to my hosting - but i already have a well established forum running.... but i wanted to create another forum that another website is going to use later on in the year, it all works fine, and i changed the themes database entries too just like [unknown] suggested... but i've hit a bit of a problem:

Now on the new forum, it all connects fine, but i have a cross between the original SMF template, and the template i was using... and if i try to access anything to do with the theme's settings in admin, i get this:

Unable to load the 'Settings' template.

Can you help??? my new forum looks like a mutant of my first forum!!!!  :'( :'( :'( :'( :'(

The original forum is here: http://www.cardiffscene.com/v6/index.php
and the new forum using my first forum's accounts is here: http://www.cardiffscene.com/mardigras/community/index.php

how can i fix it lol
Title: Re: Share user database for 2 (or more) different forums.
Post by: [Unknown] on November 02, 2004, 04:30:04 PM
Looks okay to me?

-[Unknown]
Title: Re: Share user database for 2 (or more) different forums.
Post by: jamesgrant on November 02, 2004, 04:30:53 PM
ok... looking at again closer, ummm i dunno what's i've managed to do lol

I've noticed that the new forum doesnt have the users listed in it..... so maybe it's not working correctly.
I get all of my personal messages from the original forum when i log into the new forum though!

and if i click on the 'more stats', i get "unable to load the stats template"


what have i done??!!!!!  :-\ :'( :'(

James
Title: Re: Share user database for 2 (or more) different forums.
Post by: jamesgrant on November 02, 2004, 04:32:44 PM
yeh it looks fine, but none of my members are there.... yet i can get my personal messages...

It's only when you log in that it explodes lol....

do i need to copy any of my themes' files from my original forum into the new forums' directory???? i didnt think i'd have to as i'd updated the 'themes' bit of the .php files like you suggested


>:( >:( >:( lol
Title: Re: Share user database for 2 (or more) different forums.
Post by: [Unknown] on November 02, 2004, 04:36:36 PM
Check the Stats.template.php file in Themes/default.  Did you share the themes table as I suggested?

-[Unknown]
Title: Re: Share user database for 2 (or more) different forums.
Post by: jamesgrant on November 02, 2004, 04:39:01 PM
on what forum??? the original one, or the new one.

I've only modified files in the 'Sources' directory as suggested.... do i need to make modifications in othe directories too???


:)
Title: Re: Share user database for 2 (or more) different forums.
Post by: jamesgrant on November 02, 2004, 04:40:28 PM
what do i need to do with the file? do i need to change all the database entries to match my original forum like i had to do in all the Sources .php files?

thanks for ya help btw lol
Title: Re: Share user database for 2 (or more) different forums.
Post by: [Unknown] on November 02, 2004, 04:53:29 PM
In addition to the tables listed in the first post, I suggest you also do the same for:

{$db_prefix}themes -> smf1_themes

You'd probably also want to share log_karma, log_online, and log_floodcontrol.

-[Unknown]
Title: Re: Share user database for 2 (or more) different forums.
Post by: jamesgrant on November 02, 2004, 05:04:38 PM
Wicked!

Thanks for that lol


dunno if it was you tinkering with the forum, but i uploaded my theme to the new forums' themes directory, and also just copied my settings.template from the original forum to the new one and it all appears to work!!

Thanks [unknown] :)

Title: Re: Share user database for 2 (or more) different forums.
Post by: jamesgrant on November 07, 2004, 07:11:54 AM
Good morning lol....

Everything is still working fine... i havent yet opened the 2nd forum up yet... but i have noticed something:

The initial setup was fine, linking the database tables and stuff, but now new members have joined my original forum, they dont seem to become "new members" in my second forum.

i had 308 members when i made the second database, and now new people are still joining my forum, it's updating the members in my original forum, but not in my second forum...

So my original forum says 309, and my new forum still says 308.  :-\ :-\
However, the new members are listed in the new forum if you search for them.... so i assume they can access it fine (seeing as it's the same database table anyways).... but it's not updating on the second forum as new people joining.... so even tho i have 309 members, the 2nd forum says i have 308 lol...

It's not important, but i just thought i'd let you know in case you have any sort of resolution for it :)

J
Title: Re: Share user database for 2 (or more) different forums.
Post by: jamesgrant on November 07, 2004, 07:26:34 AM
Just went into the new forum, and recounted all topics and statistics, which has sorted out the problem....

Is there any way to 'nudge' the forum to do that itself??? or am i going to have to 'syncronize' the forums every couple of days then??  :-\ :-\ :-\

J  8)
Title: Re: Share user database for 2 (or more) different forums.
Post by: [Unknown] on November 07, 2004, 07:27:16 AM
Quote from: [Unknown] on October 31, 2004, 05:41:46 AM
Find, Sources/Subs.php:

updateSettings(array(
'latestMember' => $latestmember,
'latestRealName' => $latestRealName,
'memberCount' => $memberCount,
'unapprovedMembers' => $unapprovedCount
));


Replace:
db_query("
REPLACE INTO prefix1_settings
VALUES ('latestMember', '$latestmember'),
('latestRealName', '$latestRealName'),
('memberCount', '$memberCount'),
('unapprovedMembers', '$unapprovedCount')", __FILE__, __LINE__);

db_query("
REPLACE INTO prefix2_settings
VALUES ('latestMember', '$latestmember'),
('latestRealName', '$latestRealName'),
('memberCount', '$memberCount'),
('unapprovedMembers', '$unapprovedCount')", __FILE__, __LINE__);


-[Unknown]

-[Unknown]
Title: Re: Share user database for 2 (or more) different forums.
Post by: jamesgrant on November 07, 2004, 07:59:45 AM
hi [unknown].... thanks for the tip lol... i should have read the entire post!!  ::)

That kills my forum though:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/crdscene/public_html/v6/Sources/Subs.php on line 1540

anything i am doing wrong?
Title: Re: Share user database for 2 (or more) different forums.
Post by: [Unknown] on November 07, 2004, 08:05:15 AM
Are you sure you copied and pasted exactly as I posted?

What code did you remove, and what did you add?

-[Unknown]
Title: Re: Share user database for 2 (or more) different forums.
Post by: jamesgrant on November 07, 2004, 08:27:04 AM
i took out

updateSettings(array(
            'latestMember' => $latestmember,
            'latestRealName' => $latestRealName,
            'memberCount' => $memberCount,
            'unapprovedMembers' => $unapprovedCount
         ));


and replaced it with

         db_query("
            REPLACE INTO prefix1_settings
            VALUES ('latestMember', '$latestmember'),
               ('latestRealName', '$latestRealName'),
               ('memberCount', '$memberCount'),
               ('unapprovedMembers', '$unapprovedCount')", __FILE__, __LINE__);

         db_query("
            REPLACE INTO prefix2_settings
            VALUES ('latestMember', '$latestmember'),
               ('latestRealName', '$latestRealName'),
               ('memberCount', '$memberCount'),
               ('unapprovedMembers', '$unapprovedCount')", __FILE__, __LINE__);


and it still comes up with the error.... but this time it's a different line number  ::)
Title: Re: Share user database for 2 (or more) different forums.
Post by: jamesgrant on November 07, 2004, 08:28:35 AM
lol i think i know what i've done....

i need to change the prefix1_settings
and prefix2_settings

with my database names??????


oooops lol
Title: Re: Share user database for 2 (or more) different forums.
Post by: Oldiesmann on November 12, 2004, 01:57:35 PM
prefix1 and prefix2 are the database table prefixes for your two boards. However, that shouldn't have anything to do with the T_CONSTANT_ENCAPSED_STRING message. According to this (http://www.faqts.com/knowledge_base/view.phtml/aid/7731), that means you probably forgot a semicolon someplace.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on December 03, 2004, 02:25:32 AM
I have two databases setup and now I'm trying to get them to smoothly to integrate into mambo. I have it working on http://www.goosemoose.com/mambo but only the Rats Rule! forum is actually integrated, the dog forum uses a wrapper. Any ideas on how to get them both integrated? They will both work off of the single mambo log in since they share the same cookie and member database, etc.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Anguz on December 03, 2004, 05:22:49 AM
Search for mambo integration, there's be many topics on it. There's already an integration between SMF and Mambo.

http://mamboforge.net/projects/mos-smf/
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on December 03, 2004, 01:27:53 PM
That is what I am using but it's not set up for multiple forums sharing a database.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on December 06, 2004, 10:14:31 PM
I can't get themes to work properly over shared databases. I've shared the themes table, but wierd things happen. I am seeing the themes I have created in forum A listed in forum B's admin panel, but not for the users when they are logged into B. I also think that when they switch to forum B they are ending up with the wrong theme, maybe it's going off of the same ID of forum B? I also noticed I have 2000 entries in my themes table for forum A and almost all of them are from theme id 1. I think that it hasn't been deleting as I have been deleting and recreating themse over time.

What do you suggest as the best way to set this up. I want to have two themes only on each board, and I want that theme to follow each user. What do I setup i n the admin panel of each board, meaning what directory, do i set up the same theme names, same id, etc.

Thanks
Title: Re: Share user database for 2 (or more) different forums.
Post by: [Unknown] on December 07, 2004, 08:33:10 PM
The themes table stores the settings and options for every theme.  This includes the themes themselves, their paths, and the member's options.

Sounds like knownThemes (on the settings table) needs to be syncronized between the two.

-[Unknown]
Title: Re: Share user database for 2 (or more) different forums.
Post by: Cal-Look on December 10, 2004, 09:18:38 PM
I've followed the instructions as posted and it worked perfectly - I couldn't believe it. But I've noticed a small bug - when I go to either board and click the link that lets me load the posts that have been posted since my last visit, I get an empty list, when I know that there are new messages. I've even posted new messages from an alter profile, on both boards, to test it out. Any thoughts? have I missed something?

Thanks for the help - I'm really loving the software!
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on December 11, 2004, 03:50:52 AM
Quote from: Cal-Look on December 10, 2004, 09:18:38 PM
I've followed the instructions as posted and it worked perfectly - I couldn't believe it. But I've noticed a small bug - when I go to either board and click the link that lets me load the posts that have been posted since my last visit, I get an empty list, when I know that there are new messages. I've even posted new messages from an alter profile, on both boards, to test it out. Any thoughts? have I missed something?

Thanks for the help - I'm really loving the software!

Make sure you shared all the tables correctly. It sounds like you made a mistake somewhere as I have 3 forums shared right now and that feature works for me.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Cal-Look on December 13, 2004, 09:16:55 AM
I'm going to go over the tables again, but for me this was a plug-and-play situation - I made all the suggested changes and set it up as per he instructions at the beginning of this Topic and it worked like a charm. I'm just not sure where to go to fix this. The tables were prefixed as suggested and beyond that, it should be fine, no? I'll poke around. Thanks!
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on December 28, 2004, 03:46:26 AM
Okay, first I managed to get 3 forums setup as mambo bridges and shared them. I basically installed 3 versions of the mambo bridge (edited a few files, msg me if you want them). Since several of the tables are shared once the user logs into any of the forums they log into all of them. This also avoids using wrappers.

Now for the questions. Any way to move a thread to a board on one of the other forums? This would be great as I am finding reasons to do this a lot. If not I was thinking of writting a mod to do this but how many other people would actually want it? Any idea where to start?

Second, is there a way to share one of the categories in each of the forums? For example I have a random chatter board on the Rats Rule forum that is the primary one that gets used, and everyone wants to chat on it. It would make it easier if I could just mirror that to each forum.

Thanks
Title: Re: Share user database for 2 (or more) different forums.
Post by: Anguz on December 28, 2004, 04:24:17 AM
I don't know how you'd do it with separate forums... I think [Unknown] explained in a similar topic, how to add an ID_FORUM to the boards table, which seems to be a simpler way of doing what you're asking for.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Anguz on December 28, 2004, 04:25:44 AM
http://www.simplemachines.org/community/index.php?topic=21252.msg175830#msg175830
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on January 08, 2005, 08:26:28 PM
Okay,
I finally sat down and went through what [Unknown] had posted. This might work but only if I moved all the forums into the same table called boards. I would rather leave everything in seperate tables as they are. I took a look at movetopic.php and it looks like the answer would be to edit how it works but I wanted to know if anyone else had some ideas. It's always harder to edit someone elses code  ::)
Title: Re: Share user database for 2 (or more) different forums.
Post by: HoTmetal on January 13, 2005, 12:34:34 PM
QuoteFirstly, thanks SO much for this post - it was exactly what I needed.
Me too. I just did a search, but didn't find this post... I just happend to walk into it..lol
Good job spacemanspiff.

This does leave me with one question. Does this mod insert new users into 1 DB, or both, or do you choose witch one you want to use?

Ps Anguz I just read your mod. post. If you still need someone to setup a test board for this IM me &  I can do it. Also, should I use this mod here, or yours? Thanks in advance [again] rickc
Title: Re: Share user database for 2 (or more) different forums.
Post by: Anguz on January 13, 2005, 05:31:37 PM
Hi rickc, PMing you now.
Title: Re: Share user database for 2 (or more) different forums.
Post by: jazz on January 29, 2005, 08:51:36 PM
Hello.  Reading this section, it helped me come up with some ideas for the use of my forum.  My question is this:

Can this be set up to allow a certain member group in my existing forum to use?  Basically it would be closed to the public, and there available to one member group but not everyone.

Thanks!
Title: Re: Share user database for 2 (or more) different forums.
Post by: Anguz on January 29, 2005, 08:54:21 PM
You could, you'd have to set the whole second forum to allow only that group access.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Kazona on February 22, 2005, 07:05:06 AM
Could anyone tell me how I would share the global permissions for each board? As it is now, whilst membergroups are shared, the permissions for them seem to still be handled seperately. The thing is, on my boards with each membergroup a member gets more privileges. However, after setting permissions for all the membergroups in one board, I noticed that the permissions in the other board hadn't changed at all.

So, simply put, how do I make it that the global permissions for membergroups are the same on both boards (not local permissions obviously).
Title: Re: Share user database for 2 (or more) different forums.
Post by: [Unknown] on March 06, 2005, 11:26:58 PM
You'd share the permissions table, but this would only share board independent permissions, not global board permissions.  That's a lot more complicated.

-[Unknown]
Title: Re: Share user database for 2 (or more) different forums.
Post by: nanoarray on March 19, 2005, 12:10:16 AM
Quote from: Spaceman-Spiff on September 03, 2004, 09:14:44 PM
Someone asked me how to setup 2 different SMF forums with shared user database. So, instead of writing in private message, I decide to share it here. Besides, I have never tried this myself, so I could use the feedback in case the steps I outline below are wrong or incomplete.

In the tutorial below, the following database tables will be shared:
  • im_recipients
  • instant_messages
  • membergroups
  • members
  • [/li]
You can share more tables if you like, and if you know what you're doing.

Here it goes...

1. Installing the forums
Install two (or more) different SMF forum in the same database, but using different prefix. For this example, the first forum is using "smf1_" (without quotes) and the second is using "smf2_". Just install the two forums normally, don't start telling users to sign up yet.


2. Modifying the source code
Open each of the .php files located in the Sources directory in your hard drive using a text editor program. Find all occurances of "{$db_prefix}members" and replace with "smf1_members" (without quotes). Do this for every single .php file in the Sources directory. Also find and replace the following:
"{$db_prefix}im_recipients" => "smf1_im_recipients"
"{$db_prefix}instant_messages" => "smf1_instant_messages"
"{$db_prefix}membergroups" => "smf1_membergroups"
You can also share more tables if you want and know what you're doing.

If you have a text editor program that can do batch replace or replace in all opened documents, use that instead, it will ease the task a lot (you can open everything at do a replace for all of the opened files). One text editor program that I know can do this is JCreator (http://www.jcreator.com/).


3. Upload the modified source files
Upload the content of the Sources directory that you just modified above to the Sources directory in your forum(s), overwrite any existing files. You don't need to do this for your first forum (smf1_), but doing this won't cause any problems.

Your forums should now share the same member, membergroup and instant message database.


4. Optional settings
If both (or all) of the forums are hosted on the same site (domain), you can use the same Cookie name for SMF, so users won't need to login twice when moving from one forum to another. You can find this setting inside the Admin Center -> Edit Server Settings -> Cookie Name


Possible Issues
  • User uploaded avatar
    Temporary solution: disable this feature.
    Better solution: also share the "attachments" table and synchronize the attachment settings (Admin Center -> Edit Features and Options -> Attachments section). This probably won't work if the forums are in different domains or subdomains.
  • Forum with multiple themes (ID_THEME conflict in members table)
    Temporary solution: use the same themes, or set the default forum theme for all of the forum using the same ID, and don't let users select their own theme.
  • [/li]


Other recommended tables to share:
- log_karma
- log_online <- session might get screwed if the forums are in different domains


Any comments/suggestions/errors?
I keep on thinking I'm forgetting something here... ::)

I did all the above, but it only works for admin and not for new registered users.  What else do I have to do?
Title: Re: Share user database for 2 (or more) different forums.
Post by: [Unknown] on March 19, 2005, 01:49:19 AM
So they don't show up in the members table?  Do they show up in the old/other members table?

-[Unknown]
Title: Re: Share user database for 2 (or more) different forums.
Post by: nanoarray on March 19, 2005, 04:19:34 AM
Quote from: [Unknown] on March 19, 2005, 01:49:19 AM
So they don't show up in the members table?  Do they show up in the old/other members table?

-[Unknown]

I got it now.  I mixed up my naming system, so it didn't change.  Now it's fine.

My next problem: when I log in, it shows as guest on the 2nd forum but as user on the 1st (original) forum.   How to fix that?
Title: Re: Share user database for 2 (or more) different forums.
Post by: nanoarray on March 19, 2005, 12:26:37 PM
I notice two things are wrong.

Suppose forum 1 has the member list, and forum 2 shares that same list.

a) If you log in forum 1 and then go to forum 2, everything goes smoothly.  You can read postings in both forums with a "log-in" status.  This is correct.

b) If you log in forum 2 and then go to forum 1, everything goes smoothly still.  But as soon as you try to read posting in forum 1, you get log off automatically which doesn't happen in a).

c) Continue from b).  When you log off forum 2, your status shows as "log off".  But when you go to forum 1, your status shows as "log in" still, even though you already log off from forum 2.

Any suggestion as to how to rectify this?

Title: Re: Share user database for 2 (or more) different forums.
Post by: nanoarray on March 19, 2005, 01:25:51 PM
How do you combine the total post and total topic in both forums, so that both forums show the same numbers?
Title: Re: Share user database for 2 (or more) different forums.
Post by: raedzaro on March 22, 2005, 05:56:29 AM
thanks but How share two forums with two differrent languages?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Jan on April 15, 2005, 03:16:40 AM
I share user DB for 2 differnt forums smf1_ and smf2_ and it works fine but I wonder about "Users Online".

When I 'm watching "smf1_"  I will see myself in "Users Online" section but when I'm watching "smf2_" I havn't seen my name in "Users Online" section. Why?

Do I need to share other tables?  ::)
Title: Re: Share user database for 2 (or more) different forums.
Post by: [Unknown] on April 15, 2005, 10:42:13 AM
That's the smf_log_online table.

-[Unknown]
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on April 16, 2005, 06:53:27 PM
Quote from: [Unknown] on October 31, 2004, 05:41:46 AM
Find, Sources/Subs.php:

updateSettings(array(
'latestMember' => $latestmember,
'latestRealName' => $latestRealName,
'memberCount' => $memberCount,
'unapprovedMembers' => $unapprovedCount
));


Replace:
db_query("
REPLACE INTO prefix1_settings
VALUES ('latestMember', '$latestmember'),
('latestRealName', '$latestRealName'),
('memberCount', '$memberCount'),
('unapprovedMembers', '$unapprovedCount')", __FILE__, __LINE__);

db_query("
REPLACE INTO prefix2_settings
VALUES ('latestMember', '$latestmember'),
('latestRealName', '$latestRealName'),
('memberCount', '$memberCount'),
('unapprovedMembers', '$unapprovedCount')", __FILE__, __LINE__);


-[Unknown]

What should this be in 1.1? The code has changed quite a bit.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Jan on April 19, 2005, 11:12:19 AM
Thank you  :)
Title: Re: Share user database for 2 (or more) different forums.
Post by: jazz on April 21, 2005, 08:44:28 AM
Quote from: Spaceman-Spiff on September 03, 2004, 09:14:44 PM
2. Modifying the source code
Open each of the .php files located in the Sources directory in your hard drive using a text editor program. Find all occurances of "{$db_prefix}members" and replace with "smf1_members" (without quotes). Do this for every single .php file in the Sources directory. Also find and replace the following:
"{$db_prefix}im_recipients" => "smf1_im_recipients"
"{$db_prefix}instant_messages" => "smf1_instant_messages"
"{$db_prefix}membergroups" => "smf1_membergroups"
You can also share more tables if you want and know what you're doing.

Do the source files get modified in the old forum or just for the new forum?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on April 21, 2005, 03:56:17 PM
Just the new forum.
Title: Re: Share user database for 2 (or more) different forums.
Post by: jazz on April 21, 2005, 09:49:27 PM
I saw a post from [Unknown] suggesting to do it for the themes table also.  Would I just look for "{$db_prefix}themes" and replace with "smf1_themes"?

Could someone let me know what the benefits of this would be?  I thought I'd try it, but I'm not sure of the benefits.  It seems to me like you can be more efficient by using child boards and permissions.  In what situation would one want to use two different forums with the same member list?

Edited ...  The first part of my question was answered here...

Quote from: [Unknown] on November 02, 2004, 04:53:29 PM
In addition to the tables listed in the first post, I suggest you also do the same for:

{$db_prefix}themes -> smf1_themes

You'd probably also want to share log_karma, log_online, and log_floodcontrol.

-[Unknown]

If anyone knows the benefits of 2 different forums, I'd like to hear it. 

Thanks!
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on April 21, 2005, 10:33:24 PM
Check out my site http://www.goosemoose.com , click on Pet Forums. The main problem is the way that child boards have their layout. They are just listed under the main category, where multiple forums will give you a normal layout.
Title: Re: Share user database for 2 (or more) different forums.
Post by: jazz on April 21, 2005, 11:14:15 PM
One other question I had is this... I don't want to get through all of the source files and then find out I did it wrong.  Do I change the themes and all the other codes to "{$db_prefix}themes -> smf1_themes" or "smf1_themes"?

Also, is there any way to make it appear as just another board on the main forum?  When you click to enter, it would automatically take you to the 2nd forum.

And... would it hurt to share all of the tables and just get rid of the other tables created during the installation?  If it's ok to do this, are all the files that need to be edited in the sources directory?

Quote from: Goosemoose on April 21, 2005, 10:33:24 PM
Check out my site http://www.goosemoose.com , click on Pet Forums. The main problem is the way that child boards have their layout. They are just listed under the main category, where multiple forums will give you a normal layout.

You have all 3 forums in one directory.  How did you do that?  (Nice site btw)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on April 22, 2005, 02:57:50 AM
Hi Jazz,
What do you mean in the same directory? They are actually in three: cfc,dfc,rfc.

You want to change it to smf1_themes

No way right now to just make it just to another forum, that's what I was looking for before with sub forums, but it's not something being implemented right now.
  You technically could delete the tables you aren't sharing, but I've kept them just in case something happens when I'm upgrading or something so I can fall back on the original tables.
Title: Re: Share user database for 2 (or more) different forums.
Post by: jazz on April 22, 2005, 05:18:35 AM
Quote from: Goosemoose on December 28, 2004, 03:46:26 AM
Now for the questions. Any way to move a thread to a board on one of the other forums? This would be great as I am finding reasons to do this a lot. If not I was thinking of writting a mod to do this but how many other people would actually want it? Any idea where to start?

I didn't see an answer to this question.  Is there a way to move posts between the 2 boards?

I'm going to go through the tables again, but the first attempt didn't work properly.  It appeared to work, but it only showed 1 member in the information box.  That was the member that I created during the installation.  I click on view all members, and they are all there.  I missed something somewhere, so I'll go through it again.

Edited:  I know I updated all of the files this time.  It shows in the forum information box that there is only one member, but when I click on view all members they are all there.  Using Bloc's Helios theme.

Is there anything that I need to edit outside of the "sources" directory?
Title: Re: Share user database for 2 (or more) different forums.
Post by: jazz on April 22, 2005, 05:48:29 AM
I'm sure that my normal help for this topic has gone to bed.   ;)  Is there anyone else who can help me with these questions?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on April 22, 2005, 01:07:25 PM
Do you have them set to share the same template?
Title: Re: Share user database for 2 (or more) different forums.
Post by: jazz on April 22, 2005, 02:09:20 PM
probably not.  What do I need to change to share the same template?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on April 22, 2005, 06:45:57 PM
In the admin panel you can create a new template and point it to the theme of your choice in the directory of your first forum.
Title: Re: Share user database for 2 (or more) different forums.
Post by: jazz on April 22, 2005, 06:56:31 PM
The theme's appear to be shared.  I just need to copy some of the images to the new forum directory to make it look ok.

3 questions...

This is in the information box of the new forum.

1 Posts in 1 Topics by 1 Members - Latest Member: jazz

Shouldn't it show the number of members and posts from the original forum?

And, the members online show correct except it doesn't show me online in the new forum.

Also, did you ever resolve the issue of moving posts between forums?
Title: Re: Share user database for 2 (or more) different forums.
Post by: jazz on April 22, 2005, 09:44:03 PM
I'm just going to simplify my question to make it easier to answer.

I want to share all tables with the exception of topics and boards.  So, the boards and new posts on the new board will be completely seperate.  What do I need to not modify to make sure the topics and boards are kept seperate?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on April 22, 2005, 10:47:31 PM
Okay, if you aren't showing as online on the other forum you didn't share the log_online table. I still haven't resolved moving posts between forums. You can look up ID_Forum for another way to share forums that will let you move posts.
Title: Re: Share user database for 2 (or more) different forums.
Post by: jazz on April 22, 2005, 11:10:15 PM
Thanks, I'll try again when I get home.

The thing I'm going to have to do is move all posts to the new forum and delete the ones that I don't want there.  What table do I need to copy over to the new forum?  Then I can just delete the posts I don't want there.
Title: Re: Share user database for 2 (or more) different forums.
Post by: taz on July 13, 2005, 06:02:35 PM
Spaceman-Spiff Will this also work on SMF 1.1 Beta 3?  I have tried to get it to work but I keep getting   
Table 'Password_Forum.smf_smf_members' doesn't exist
Title: Re: Share user database for 2 (or more) different forums.
Post by: taz on July 22, 2005, 12:06:29 AM
Ok that now works great BUT, it still won't tally the members on the second board if they register on the first, or vice versa... what do I need to change in the subs.php for SMF 1.1 Beta 3

Thank you
Taz
Title: Re: Share user database for 2 (or more) different forums.
Post by: Elmacik on September 21, 2005, 10:38:15 PM
i couldnt find these in source files:
"{$db_prefix}im_recipients" => "smf1_im_recipients"
"{$db_prefix}instant_messages" => "smf1_instant_messages"


well i couldnt do it, please help :(
i replaced the members and membergroup tables (to get from the first forum)
but i cannot login in the newest. it says check cookie settings.
(i cannot change cookie settings since i cannot login)

edit: i got it. i deleted cookies and set both their cookie names the same. now works fine.
and about the tables i couldnt find are changed in new version, here they are:

{$db_prefix}personal_messages  ==> smf1_personal_messages
{$db_prefix}pm_recipients  ==> smf1_pm_recipients
Title: Re: Share user database for 2 (or more) different forums.
Post by: Gwydion Frost on November 07, 2005, 03:42:17 AM
OK, here's a different variation on this idea I would like to implement on my boards.

Creating a plethora of RolePlaying Game Boards, with many different Genres represented.

Would love to have the ability to have the member register on the MAIN site with an "Out-Of-Character" identity as a MASTER PROFILE. Ex: Bob from Ohio.

Now, when the member would click on the link to the subdomains (each separate board for each game), they would be prompted to create a CHARACTER PROFILE specific to that game.

In the Fantasy game, "Bob from Ohio" would name his character "Elohas", the rest of the CHARACTER profile indicating that he's an Elf from Arcansbane.

Bob decides that he wants to play the superhero RPG...and clicking over to THAT board, Bob is prompted to create his CHARACTER PROFILE for THAT game.

Each Character Profile would post as the Character on the board it is designated to post on, but ADMINISTRATIVELY, I would be able to tell that Bob from Ohio was Elohas, Texas Pete, and SuperVulcan, etc etc.

Because of the size of each of these boards (each templated to it's own theme), and the amount of players that will be jumping on to play, you can see my hesitation to place them ALL on one single database...

The server would go nuts with the amount of queries.

The side effect would be to slow my site down to a crawl, even just to refresh the page.

Is there a way to SEPARATE the member data (along with all the usergroup permissions, etc) into a separate DB, and still have all the separate boards access the info?

Mind you, I have NOT installed SMF yet, as I am inquiring on how I can get it to do the things I want it to beforehand?

I haven't even approached the next half of this question...

ROUND #2: Is it possible to make the character profiles like a check list...pick a race, pick a region, etc etc, and have usergroups automatically assigned by doing so...(purpose for this? The Compendium is designed to be USER specific...an Elf from Country A has certain beliefs that an Elf from Country B doesn't...due to different cultures, etc...and therefore, the Compendium will be designed to show the player what his character would believe, versus revealing the whole TRUTH (which is only shown for the character's own species).

Make sense?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Elmacik on November 24, 2005, 10:55:15 AM
Ok folks, what to do to make the forums automatically count the same members?
What [unknown] gave is quite old and doesnt work for new versions.
Title: Re: Share user database for 2 (or more) different forums.
Post by: TheMaTrIx on December 24, 2005, 10:35:31 AM
Quote from: GwydionFrost on November 07, 2005, 03:42:17 AM
Is there a way to SEPARATE the member data (along with all the usergroup permissions, etc) into a separate DB, and still have all the separate boards access the info?

If you refer to this thread:

http://www.simplemachines.org/community/index.php?topic=61677.0

I'm testing how to use MySQL 5's FEDERATED table type to share user tables, do bans globaly and use Private messaging across the boards.

Its all working fine except for PM's (initialy, I'll get past that problem :p), they get writen, show as "Hey, thematrix, you have 2 messages, 2 are new." but no PM's are shown when you check your inbox. Wierd
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on December 24, 2005, 06:35:40 PM
Orstio and I developed a new technique that's much simpler. check ouy www.goosemoose.com and visit all the forums to see the results.  everything runs in one folder and one database table set. let me know of you're interested. once rc2 is out ill post how to do it.
Title: Re: Share user database for 2 (or more) different forums.
Post by: TheMaTrIx on January 03, 2006, 08:28:48 PM
Quote from: Goosemoose on December 24, 2005, 06:35:40 PM
Orstio and I developed a new technique that's much simpler. check ouy www.goosemoose.com and visit all the forums to see the results.  everything runs in one folder and one database table set. let me know of you're interested. once rc2 is out ill post how to do it.

The reason I'm trying to create a way to run with several databases is because its not a good idea to put to many tables in 1 database.

The network part of the site I'm building is a splitup of 1 single site that hosts a big load of developers that, once they reach a certain size of published content, get their own forum and/or portal.

Currently we already have about 20 lined up, so that would make that if every site has a forum, the network database would have like 500 tables, which is both bad databasing and totaly crap for managment.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Carver on January 20, 2006, 09:39:31 AM
Quote from: Goosemoose on April 16, 2005, 06:53:27 PM
Quote from: [Unknown] on October 31, 2004, 05:41:46 AM
Find, Sources/Subs.php:

updateSettings(array(
'latestMember' => $latestmember,
'latestRealName' => $latestRealName,
'memberCount' => $memberCount,
'unapprovedMembers' => $unapprovedCount
));


Replace:
db_query("
REPLACE INTO prefix1_settings
VALUES ('latestMember', '$latestmember'),
('latestRealName', '$latestRealName'),
('memberCount', '$memberCount'),
('unapprovedMembers', '$unapprovedCount')", __FILE__, __LINE__);

db_query("
REPLACE INTO prefix2_settings
VALUES ('latestMember', '$latestmember'),
('latestRealName', '$latestRealName'),
('memberCount', '$memberCount'),
('unapprovedMembers', '$unapprovedCount')", __FILE__, __LINE__);


-[Unknown]

What should this be in 1.1? The code has changed quite a bit.

did anyone come up with an answer for this part ?

Thanks
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on January 20, 2006, 04:30:58 PM
No, I'm using a new method that I've described in the Mambo section. Works 10x better for me. I think I called it the Shared Forum Mod.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Carver on January 20, 2006, 05:58:28 PM
Thanks
I will take at look at it, but I am using Bloc's Tiny Portal, and don't need Mambo for what I have going.
Goosemoose if you stop back here again does your SSI work with the multi forums?
I keep getting a can not find database error on my second forum, i have edited the SSI script to match the shared tables. members, membergroups,etc but still no go...
Thanks Again
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on January 20, 2006, 09:47:25 PM
Everything works. I really only have one forum installed but the illusian of 8 :) Makes upgrades and mods MUCH easier to handle.

You could do the install even without mambo, it just wouldn't work quite a nicely. I'd try it on a test site first.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Carver on January 21, 2006, 11:11:20 AM
Thanks I decided to do just that, have Mambo, and new SMF loaded and I am working through your instructions.
Thanks Again
Curt
Title: Re: Share user database for 2 (or more) different forums.
Post by: manuelap on March 04, 2006, 07:58:49 AM
Quote from: Spaceman-Spiff on September 03, 2004, 09:14:44 PM
In the tutorial below, the following database tables will be shared:
  • im_recipients
  • instant_messages
  • membergroups
  • members

I am using SMF 1.1 RC2 and find the tutorials in this topic of no use to me... Correct me if I am wrong, but this tutorial was made for SMF 1.0.6? Who has altered code for the version I am using????

Hope to hear from you!
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on March 04, 2006, 05:01:58 PM
Carver, I recommend checking out my mod in the mambo section, it works much much better than this method, and only involves a few lines of code.
Title: Re: Share user database for 2 (or more) different forums.
Post by: SanSite.Info on May 07, 2006, 10:02:02 AM
Hello,

I am not getting this to work.  I got 2 Forums, and 2 different database in the same server.

- Both the forums are working fine with version 1.05 and 1.07 respectively ( is this fine having to merge 2 different versions ?? )

- Both the forums also have a different prefx name, smf and smf1

- Now I have changed this "{$db_prefix}members" and replace with "smf_members"" in my second forum ( I just took the members alone to see if its working )

So from this, it is clear that my 2nd forum which has got a prefix "smf1" is pointing to "smf" for the members.

-------------

But When I goto my 2nd forum, I am getting this message :

Database Error   
Please try again. If you come back to this error screen, report the error to an administrator.


-------------

Now I am stuck up here and I wish to proceed merging my 2 forums to one.


Few Queries :
a) If I change the prefix name of one forum alone to that of the 2nd forum, how will it take members of both forums and how will it count them.

b) Is it possible to overwrite one forum's database with the values of the other. And will tis step be successfull.


Please help me asap.

Thanks.

- San





Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on May 07, 2006, 03:35:10 PM
You are on the right track. You need to change {$db_prefix}members to smf_ in all your files. As well as make the other changes. If you already have members in both forums you will have to merge them which is going to be a decent sized task. You will have to change their ids in all their posts, threads and in the 2nd forum before pointing the info to the first. You will also have to deal with any name and id duplication issues. The instructions in this tthread are meant for starting a second forum and will have to be adapted if you are merging two existing ones.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on May 07, 2006, 03:44:07 PM
BTW, are you using Joomla or Mambo on your site?
Title: Re: Share user database for 2 (or more) different forums.
Post by: SanSite.Info on May 07, 2006, 04:38:35 PM

Hello,

Thanks for your reply.


I am not using both. I just have a SMF Community and I want to merge it with another.

Will It work fine, If I take the Members Part alone from the database file of one community and paste it in the members part of the other community's database.

I dont need the post to be merged, jus the members.

- San
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on May 07, 2006, 07:51:11 PM
No it won't work fine because you will have duplicate member id's and duplicate member names. You would have to run a query to increase the member ids of one of the tables and change any member names that would be duplicates, then you could merge.
Title: Re: Share user database for 2 (or more) different forums.
Post by: SanSite.Info on May 08, 2006, 04:50:30 AM

Hello,

Thanks Once Again for the reply.

Can you please tell me the query in detail that I need to run in my phpmyadmin to modify the existing to make it unique.

I guess this task is gona be a little complicated.

Now I got a Community with 10000+ Members and another with 1000+, I wish to merge these two. So can anyone give me a query that will compare these 2 members tables for similar ids.



Please help me in this regard as this requirement is a little urgent.

- San


Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on May 08, 2006, 12:49:50 PM
Do you plan on abandoning all the posts from one of the boards? Which board are you getting rid of , the 10000 or the 1000? This is really a question for the main support board if you are not planning on continuing to run both boards.
Title: Re: Share user database for 2 (or more) different forums.
Post by: SanSite.Info on May 09, 2006, 03:26:11 AM
Hello,

Thanks For The Reply.


I wish to take the Members from the 10000+ Forum and retain everything present in the 1000 Member Board


So I would have to retain the 1000+ Forum Board and modify the database in such a manner that it takes the members only of the 10000+ Board.


Please Help Me In this regard


- San





Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on May 10, 2006, 03:16:19 AM
Go ahead and make a new thread and ask. This is more a general questions than a sharing forum question.
Title: Re: Share user database for 2 (or more) different forums.
Post by: theunder-ground on May 11, 2006, 01:22:35 AM
I have 1 forum established and 1 that I am going to be opening up soon.

I shared the following tables:

members
im_recipients
instant_messages
membergroups
attachments
log_online
themes

I also have the new boards attachments setting to point to the origional board attachment setting.

I have a few problems.

1. I added another field using Unknown's tutorial http://www.unknownbrackets.com/tutorials/custom-profile what I added is not being transfered to the new board. 

2. None of the user uploaded avatars are showing

3. Even using the code provided by Unknow the stats will not count themselves properly.  I have to manually go in and have them recounted.

4. My membergroups are not able to see the posts on the new forum.  I am thinking that I may need to have the permissions and board_permissions tables shared as well.  Is that correct?

The 2 forums are on the same database, the new forum is a sub-domain of the main URL
Title: Re: Share user database for 2 (or more) different forums.
Post by: silverdragonrs on May 12, 2006, 03:21:31 AM
ok.... i was fine understanding all this untill people started talking about mambo ans such.... what the heck is mambo? i am running SMF off of my own server...(running apache2triad) I have 7 forums and i need to merge 5 of them.... i am running 1.0.7 and heve no intentions of upgrading or changing it any time soon (if it aint broke dont fix it theory)

how can i successfully merge these forums. I understand the original procedure but it is a couple years old and the versions have changed. nobody has posted a fix in a while... not sure where to go from here...... could somebody post new instructions for the updated versions please.. if its the same then please say so. mean while i will test these instructions (those i understood) on a fresh install of SMF and try and link it to one of the others.....

could you tell me what mambo is for and how it would benifit? and tell me if i get you right.. if i use mambo (what ever it is) I can merge all my forums with only a few lines of code as opposed to going through ALL this? or does using this only save a few steps?

thanks,
danny
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on May 12, 2006, 09:09:21 PM
Yes, using Joomla or (used to be mambo but there was a split of the software and now they both exist) the shared can be done with only a few lines of code. Check out http://www.goosemoose.com/ and go to Pet Forums. All the forums you see are actually one SMF install made to look like multiple forums.

BUT it's only easy to create the multiple shared forums. If you have pre-existing forums then that is a whole other ball of wax. I don't have any good suggestions on an easy way to accomplish this, as it's not easy. I merged 3 originally and it required changing all the id's for posts, topics and members, and isn't an easy task. Maybe someone else has an easier solution.
Title: Re: Share user database for 2 (or more) different forums.
Post by: silverdragonrs on May 17, 2006, 01:07:52 AM
I think i have found a solution to many of the problems... but still have the problem of.... I HAVE NO CLUE WHAT I AM DOING!!! :) no really.. I have gotten almost nowhere... i have a theory though..... is it ok if I PM you with it and if it works then it can be posted... I don't want to post something that may be midtaken as a solution and mess up somebodies forums...:(  PM me if it's cool goosemoose

Thanks,
danny
Title: Re: Share user database for 2 (or more) different forums.
Post by: starbois on June 03, 2006, 04:56:34 AM
Hi

Can someone from SMF help to post the codes for 1.1RC1 to replace the one from version 1.0x.

Appreciate.


Quote from: [Unknown] on October 31, 2004, 05:41:46 AM
Find, Sources/Subs.php:

updateSettings(array(
'latestMember' => $latestmember,
'latestRealName' => $latestRealName,
'memberCount' => $memberCount,
'unapprovedMembers' => $unapprovedCount
));


Replace:
db_query("
REPLACE INTO prefix1_settings
VALUES ('latestMember', '$latestmember'),
('latestRealName', '$latestRealName'),
('memberCount', '$memberCount'),
('unapprovedMembers', '$unapprovedCount')", __FILE__, __LINE__);

db_query("
REPLACE INTO prefix2_settings
VALUES ('latestMember', '$latestmember'),
('latestRealName', '$latestRealName'),
('memberCount', '$memberCount'),
('unapprovedMembers', '$unapprovedCount')", __FILE__, __LINE__);


-[Unknown]
Title: Re: Share user database for 2 (or more) different forums.
Post by: starbois on June 03, 2006, 11:18:16 PM
Did some tweaking and managed to get it to work on 1.1RC1. No guarantee, u can try and let me know if it works. Here's the modifications u need to do:

Find in Sources/Subs.php:

db_query("
UPDATE {$db_prefix}settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));


Replace with:

db_query("
UPDATE yourprefix1_settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));

db_query("
UPDATE yourprefix2_settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));



Then find:

db_query("
REPLACE INTO {$db_prefix}settings
(variable, value)
VALUES " . implode(',
', $replaceArray), __FILE__, __LINE__);


Replace with:

db_query("
REPLACE INTO yourprefix1_settings
(variable, value)
VALUES " . implode(',
', $replaceArray), __FILE__, __LINE__);

db_query("
REPLACE INTO yourprefix2_settings
(variable, value)
VALUES " . implode(',
', $replaceArray), __FILE__, __LINE__);



Note: Remember to change yourprefix1 and yourprefix2 to your own prefix.



Title: Re: Share user database for 2 (or more) different forums.
Post by: LostProphecy on June 14, 2006, 05:26:05 AM
i've been looking at this and also looking at the mambo one that i think goosemore suggested and i'm trying to work out which would be better for me,

i currently have a 180 member forum with about 70,000 posts and i would like to create a multiple forum layout, i am not too fussed on which way it gets done.

I know nothing about mambo or portals or anything like that.

I would like each forum to have different membergroups, i don't know if this can be done or it just wont work, my current site is a harry potter site so it has membergroups that are the 4 houses, i want to create some other movie sites so obviously i don't want lets say we have member x that is in "gryffindor" when they go over to the lord of the rings forum i do not want member x showing up as being in 'gryffindor' for that forum i might want member x showing up as say "elf", will just not sharing the membergroup table fix this? or will it create more problems then it's really worth.

On the theme issue, if you were using a default theme allround and then using set themes for certain boards (you know the option in the board menu where you make a theme display on a particular board) will this work? as it is not a theme setting that is in the members table it is a setting that is in the boards area.

Will mods like the membermap and the SMFshop become a globalised thing (showing up the same on all forums) or will they always be a "per forum" thing.

Is it possible to keep the karma as a per forum thing? or will that stuff up cause karma appears in the shared members table?




i suppose in the end all i want to keep shared is the members, their personal details and sigs and avatars, their post counts, the membermap, their online time (although i think differing online times could be very cool - being able to see who spent the most time on which forum), and the themes...

although now that i think about it, i also may  not mind even the post counts not being shared... i'm sure i could think of a way of creating a main page where they could go and see their "total personal statistics"




i'm an obsessive sort of person so i have absolutely no problems with spending hours upon hours and days upon days in even manually modifing things if i can get this to work, if i had to i would even go through all my 70,000 posts and hand change ever link that might happen to get changed if my forum gets moved to another directory... i love my site so i would pretty much go to any lengths to get it the way i want so any suggestions no matter how time consuming they are, are very welcome to me :)

~Jessi
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on June 14, 2006, 08:48:28 PM
Ok, first my mambo/joomla mod would be just like one smf forum except for the fact that you can view certain categories on each forum. Any mod applied would appear across all the forums. You can use multiple membergroups just like regular smf, but you'd have to insert your own code to make certain groups show on certain sites. Basically what you are talking about is going to take quite a bit of modification no matter how you swing it.
Title: Re: Share user database for 2 (or more) different forums.
Post by: LostProphecy on June 15, 2006, 01:54:30 AM
i realised that but i'm definitely up for the challenge trust me ;)

i have no life outside of work... so plenty of nights and weekends for me to waste on this baby :P
Title: Re: Share user database for 2 (or more) different forums.
Post by: LostProphecy on July 01, 2006, 07:37:22 AM
I've almost got my 7 forums fully intergrated with each other...

but i'm having issues with the log_online part.

for some reason even though i've shared the log_online table as well as setting all cookie names to be the same i can't log into one forum and then jump to another and also be online there... i've checked and double checked and i can't seem to see a reason as to why this isn't working. Everything else is working fine for me and i like the way it works...

the only thing i dont like is the shared membergroups but i can't do anything about it as that info is stored in the member table so nothing can be done abou that :)

can anyone possibly help with this issue?

what is the session table for? would that help my problem if i shared that table?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on July 01, 2006, 09:56:34 PM
Are these all on the same domain? Same server?
Title: Re: Share user database for 2 (or more) different forums.
Post by: LostProphecy on July 02, 2006, 04:32:20 AM
yes they are... and in the same database as well listed as smf1 through to seven

www.lostprophecy.com/central/index.php
www.lostprophecy.com/arts/index.php
www.lostprophecy.com/controversy/index.php
www.lostprophecy.com/entertainment/index.php
www.lostprophecy.com/harrypotter/index.php
www.lostprophecy.com/rpg/index.php
www.lostprophecy.com/tech/index.php

what i've done is basicly spent the last 2 weeks multiplying my current forum that is currently residing in the "forums' folder and copied all the exact same files over 7 times over and then went in and manually redirected each theme to it's appropriate urls and then changed all the database thingys to point to each one, everything including the PM's is following me around the 7 forums and stuff... everything except the online thing, i had to log online 7 times to be online everywhere
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on July 03, 2006, 02:58:41 AM
Ugh. That's what I used to do. Using the shared forum mod with joomla makes it so much easier. Go ahead and share the sessions mod, that should solve your problem. Make sure all the cookie names are the same too.
Title: Re: Share user database for 2 (or more) different forums.
Post by: theunder-ground on August 13, 2006, 10:59:20 AM
I for the life of me can not get the uploaded avatars to show from the main forum to the other.

The main forum is http://www.theunder-ground.com
Second forum is http://illusions.theunder-ground.com

Almost everything else is working between the 2
Title: Re: Share user database for 2 (or more) different forums.
Post by: LostProphecy on August 21, 2006, 02:32:25 AM
Just wondering if someone might be able to help me out...

i've noticed two things on my 7 forums that i wish to try and fix...

Firstly,

the recycling bin, i want to have a recycling bin for each forum however something seems to go astray everytime i try to set it, it appears to be a setting problem to me on forum 1 i have the recycling bin set to board 213... on my second forum when i try to set my recycling bin to board 193 it ends up not liking it and then all forums i go to (have 7 of them) have the recycling bin is set to whatever board 213 is on that particular forum...

Is there anyway of fixing this? i would like the recycling bin to be individualised for each forum...

a similar thing seems to be happening with my stats, each board has a different amount of posts and threads

If say i go into forum 1 and recount the totals it will count them to say 20,000 posts
then i go to forum 2 and recount the totals which comes to 40,000 posts
If i then go back to forum 1 the stat's now tell me that my forum now has 40,000 posts (when i know it only has 20,000 posts)... i don't get why this is happening either as the code when i look at stats.php pulls all it's numbers from the database using {db_prefix} so technically it should head straight to the database prefix that the forum is set to...

I did the modifications stated below

Quote from: starbois on June 03, 2006, 11:18:16 PM
Did some tweaking and managed to get it to work on 1.1RC1. No guarantee, u can try and let me know if it works. Here's the modifications u need to do:

Find in Sources/Subs.php:

db_query("
UPDATE {$db_prefix}settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));


Replace with:

db_query("
UPDATE yourprefix1_settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));

db_query("
UPDATE yourprefix2_settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));



Then find:

db_query("
REPLACE INTO {$db_prefix}settings
(variable, value)
VALUES " . implode(',
', $replaceArray), __FILE__, __LINE__);


Replace with:

db_query("
REPLACE INTO yourprefix1_settings
(variable, value)
VALUES " . implode(',
', $replaceArray), __FILE__, __LINE__);

db_query("
REPLACE INTO yourprefix2_settings
(variable, value)
VALUES " . implode(',
', $replaceArray), __FILE__, __LINE__);



Note: Remember to change yourprefix1 and yourprefix2 to your own prefix.


And i have shared the following database tables

{$db_prefix}members ==> smf1_members
{$db_prefix}personal_messages  ==> smf1_personal_messages
{$db_prefix}pm_recipients  ==> smf1_pm_recipients
{$db_prefix}themes ==> smf1_themes
{$db_prefix}log_karma ==> smf1_log_karma
{$db_prefix}log_online ==> smf1_log_online
{$db_prefix}log_floodcontrol ==> smf1_log_floodcontrol
{$db_prefix}membergroups => smf1_membergroups
{$db_prefix}mm_maps ==> smf1_mm_maps
{$db_prefix}mm_pins => smf1_mm_pins
{$db_prefix}shoutbox => smf1_shoutbox
{$db_prefix}sessions => smf1_sessions




I would really appreciate if someone could even just give me the tiniest guideance on this :)

~Jessi
Title: Re: Share user database for 2 (or more) different forums.
Post by: LostProphecy on August 21, 2006, 03:07:41 AM
never mind about above...

i've fixed the issue and found it to be the code modification above that causes all my issues...

I just thought that i would let everyone know incase they have similar issues...

the above code my auto update all member counts when a new member joins but at the cost of not being able to have individual board statistics and not being able to set individual recycling bin boards then i think i would rather opt to go through and recount forum statistics every time a new member joins up :)
Title: Re: Share user database for 2 (or more) different forums.
Post by: †MavN† on August 27, 2006, 05:55:23 AM
SMF 1.1 RC3
I have some strange error. I have shared this tables

{$db_prefix}ban_groups
{$db_prefix}ban_items
{$db_prefix}log_banned
{$db_prefix}log_errors
{$db_prefix}log_karma
{$db_prefix}log_online
{$db_prefix}membergroups
{$db_prefix}members
{$db_prefix}permissions
{$db_prefix}personal_messages
{$db_prefix}pm_recipients
{$db_prefix}sessions
{$db_prefix}themes

All working fine but when I am calling ssi_examples.php I have this error

: No database selected
D:\XAMPP\htdocs\smfru\Sources\Load.php
1962

I have this error only if I have share 2 tables

{$db_prefix}members
{$db_prefix}sessions

{$db_prefix} I am replaced to smfrc_ (db prefix another forum). What I am doing wrong?
Title: Re: Share user database for 2 (or more) different forums.
Post by: nathan42100 on November 14, 2006, 07:55:42 PM
BEFORE you all start yelling at me for bumping an old topic I just want to say that I chose this thread because it seemed to have the most info about doing this.


NOW, is the code below the most recent and has anyone made a mod that applies the below modifications if they are?
Quote from: LostProphecy on August 21, 2006, 02:32:25 AM
...
Quote from: starbois on June 03, 2006, 11:18:16 PM
Did some tweaking and managed to get it to work on 1.1RC1. No guarantee, u can try and let me know if it works. Here's the modifications u need to do:

Find in Sources/Subs.php:

db_query("
UPDATE {$db_prefix}settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));


Replace with:

db_query("
UPDATE yourprefix1_settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));

db_query("
UPDATE yourprefix2_settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));



Then find:

db_query("
REPLACE INTO {$db_prefix}settings
(variable, value)
VALUES " . implode(',
', $replaceArray), __FILE__, __LINE__);


Replace with:

db_query("
REPLACE INTO yourprefix1_settings
(variable, value)
VALUES " . implode(',
', $replaceArray), __FILE__, __LINE__);

db_query("
REPLACE INTO yourprefix2_settings
(variable, value)
VALUES " . implode(',
', $replaceArray), __FILE__, __LINE__);



Note: Remember to change yourprefix1 and yourprefix2 to your own prefix.


And i have shared the following database tables

{$db_prefix}members ==> smf1_members
{$db_prefix}personal_messages  ==> smf1_personal_messages
{$db_prefix}pm_recipients  ==> smf1_pm_recipients
{$db_prefix}themes ==> smf1_themes
{$db_prefix}log_karma ==> smf1_log_karma
{$db_prefix}log_online ==> smf1_log_online
{$db_prefix}log_floodcontrol ==> smf1_log_floodcontrol
{$db_prefix}membergroups => smf1_membergroups
{$db_prefix}mm_maps ==> smf1_mm_maps
{$db_prefix}mm_pins => smf1_mm_pins
{$db_prefix}shoutbox => smf1_shoutbox
{$db_prefix}sessions => smf1_sessions




I would really appreciate if someone could even just give me the tiniest guideance on this :)

~Jessi
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on November 14, 2006, 10:08:59 PM
Check out my shared forum mod. There is a post towards the end that explains how to use the mod in a non joomla environment. It's much much much easier than this method.
Title: Re: Share user database for 2 (or more) different forums.
Post by: nathan42100 on November 14, 2006, 10:15:18 PM
Would that work for creating a completely separate "wiki"forum?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on November 14, 2006, 10:16:37 PM
You can create as many forums as you wanted, all using one database, one installation. Check out http://www.goosemoose.com and look at the 7 forums there.
Title: Re: Share user database for 2 (or more) different forums.
Post by: nathan42100 on November 19, 2006, 11:13:55 PM
is there a modification that does all of this...it would make it really easy for the wiki template to just have that installed...or some command that goes through all of the files and makes the necessary find and replaces?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on November 20, 2006, 01:53:40 AM
Look up my Shared Forum Mod.
Title: Re: Share user database for 2 (or more) different forums.
Post by: nathan42100 on November 20, 2006, 07:37:46 AM
but thats not what I want...I want a completely separate forum except for the userlist. Plus I want search engine friendly urls. I want 2 different installations that have the same userlists.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on November 20, 2006, 12:53:58 PM
Then use the code like in this thread and only change the members table to both point to the same place. Note that none of there other settings will transfer and you will have to maintain two different forum installations and upgrades.
Title: Re: Share user database for 2 (or more) different forums.
Post by: nathan42100 on November 20, 2006, 04:31:16 PM
I realize that. Does it maintain moderators and admins by any chance?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on November 20, 2006, 04:37:02 PM
That would not work correctly without some additional work since you are not sharing the groups table.
Title: Re: Share user database for 2 (or more) different forums.
Post by: nathan42100 on November 20, 2006, 04:39:48 PM
could you just share the groups table and it would work?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on November 20, 2006, 04:47:01 PM
I'm not sure. There is a cascading effect since so many of the tables have column that match up with other tables. The only thing I can suggest is to try it and see.
Title: Re: Share user database for 2 (or more) different forums.
Post by: nathan42100 on November 20, 2006, 05:27:53 PM
would the membergroups get screwed up if it said that someone was in a usergroup that didn't exist?
Title: Re: Share user database for 2 (or more) different forums.
Post by: nathan42100 on November 20, 2006, 05:33:05 PM
the membergroups are shared in the instructions...
Title: Re: Share user database for 2 (or more) different forums.
Post by: nathan42100 on November 20, 2006, 10:17:03 PM
sorry for triple posting, would templates get screwed up as well?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on November 21, 2006, 12:25:13 PM
Possibly. You'd have to try it out and see. Set up 2 test forums to try it out on. This thread hasn't been needed in a long time, so I have not kept up on those areas of the code, nor do I have time to look at it now. Sorry.
Title: Re: Share user database for 2 (or more) different forums.
Post by: nathan42100 on November 21, 2006, 05:51:56 PM
Its ok. Decided not to do it anyway, just gunna use a wiki. The wikitemplate isn't all its hyped up to be...
Title: Re: Share user database for 2 (or more) different forums.
Post by: sodmanccc on March 13, 2007, 07:37:18 PM
hello,
anyone that has done this and would like to make some cash doing it for me PM me. please.
Title: Re: Share user database for 2 (or more) different forums.
Post by: SaltedWeb on March 17, 2007, 11:41:57 PM
Looks like a great idea,
A mod to do this would be great, its just so time consuming to
do all this as we have 4 forums we could use this on.

Ohwell maybe someday, but great ideas you did here.

Cozmo
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on March 19, 2007, 04:06:40 PM
This has been replaced by two other mods. Do a search for Shared Forum and you will find them.
Title: Re: Share user database for 2 (or more) different forums.
Post by: tbobker on April 29, 2007, 03:51:55 PM
This is good but what if i wanted to share all accept the default template. Would it be easier....i managed to get two forums sharing all, but the themes cannot be different and wandered where in the script it sets the theme so i could just put it in manually in one forum?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Roxius on June 21, 2007, 04:40:24 PM
What if I don't share the membergroups table?
I want different membergroups for each forum, if I don't share this table, would the forum crash?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on June 23, 2007, 08:42:03 PM
tbobker, you can look in the mod I posted, there's conversation about this.

If you aren't sharing the membergroups you might as well just install 2 copies of smf, in 2 different directories with 2 different database prefixes.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Rouge on June 24, 2007, 07:01:27 AM
How would you specify a different database?
Title: Re: Share user database for 2 (or more) different forums.
Post by: God of Ikiliki on June 27, 2007, 05:16:34 AM
How do I get the same forum stats and be possible to move a topic to another forum?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Rouge on June 29, 2007, 07:51:09 PM
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
Title: Re: Share user database for 2 (or more) different forums.
Post by: Rouge on June 30, 2007, 09:27:49 AM
bump.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Rouge on July 06, 2007, 09:38:34 AM
bump.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Rouge on July 10, 2007, 12:26:24 PM
bumpity bumpity bumparoo :/
Title: Re: Share user database for 2 (or more) different forums.
Post by: Harro on July 28, 2007, 12:07:13 PM
Did you manage to fix this?
That error probably appears because the file is not there, or it's not chmodded correctly.
Title: Re: Share user database for 2 (or more) different forums.
Post by: dazlia on September 30, 2007, 02:14:55 PM
guys could someoen PLEASE help me beofre i pull my hair out.

Ok, ive already got a forum on my domain at www.mydomain.co.uk/forum2

Ive also freshly installed a new forum at www.mydomain.co.uk/postmolar

(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)

cheers

Title: Re: Share user database for 2 (or more) different forums.
Post by: Magic_Mike on October 04, 2007, 04:30:45 PM
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"
Title: Re: Share user database for 2 (or more) different forums.
Post by: dazlia on October 05, 2007, 02:57:32 PM
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 :-

{db_prefix}members


and change them all to:-

{db_prefix2}members

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 up..........it just does it for me lol
Title: Re: Share user database for 2 (or more) different forums.
Post by: dazlia on October 05, 2007, 04:43:52 PM
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 :: molarpregnancy.co.uk '; # The name of your forum.
$language = 'english'; # The default language file set for the forum.
$boardurl = 'http://molarpregnancy.co.uk/forum2'; # 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 :)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Goosemoose on October 05, 2007, 09:09:20 PM
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.
Title: Re: Share user database for 2 (or more) different forums.
Post by: dazlia on October 06, 2007, 05:29:09 AM
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'?
Title: Re: Share user database for 2 (or more) different forums.
Post by: dazlia on October 06, 2007, 05:31:47 AM
p.s i did a search for the word 'shared' in the mods section and it found nothing !
Title: Re: Share user database for 2 (or more) different forums.
Post by: dazlia on October 06, 2007, 05:37:58 AM
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 password.................you do it for me lol :)

daz
Title: Re: Share user database for 2 (or more) different forums.
Post by: Phlipp on October 06, 2007, 06:19:20 PM
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.
Title: Re: Share user database for 2 (or more) different forums.
Post by: drgsldr69 on October 28, 2007, 10:27:47 PM
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.
Title: Re: Share user database for 2 (or more) different forums.
Post by: drgsldr69 on October 28, 2007, 11:00:11 PM
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?
Title: Re: Share user database for 2 (or more) different forums.
Post by: ctslacker on November 01, 2007, 09:37:51 AM
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.
Title: HOW TO SYNC UP AVATARS ON SHARED FORUMS
Post by: ctslacker on November 01, 2007, 04:05:36 PM
I DID IT!

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.

Woot.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Harvester on November 21, 2007, 01:12:42 PM
Quote from: Spaceman-Spiff on September 03, 2004, 09:14:44 PM
This probably won't work if the forums are in different domains or subdomains.

will it work if, for example, the first forum is here: http://www.mydomain.com/forumOne/
and the second forum is here: http://www.mydomain.com/forumTwo/

?
Title: Re: Share user database for 2 (or more) different forums.
Post by: IchBin™ on December 09, 2007, 11:37:06 PM
I would imagine that is the way it would work Harvester. As long as they are on the same domain. You can't have SMF installed twice to the same location.
Title: Re: Share user database for 2 (or more) different forums.
Post by: janilxx on January 07, 2008, 07:41:42 AM
Quote from: starbois on June 03, 2006, 11:18:16 PM
Did some tweaking and managed to get it to work on 1.1RC1. No guarantee

I have shared users between 2 forums with method described in this thread. I also made the changes described in quoted message to get registered user statistics for both forums.
There is problems with this change (click "Quote from"). After this change MANY setting changes goes to both forums.
If you want this change to affect only total and latest members, you should have this kind of if:
if (($variable != 'totalMembers') && ($variable != 'latestMember') && ($variable != 'latestRealName'))
{
    use old code
}
else
{
    use new code with 2 SQL statements
}

Also unapprovedMembers could be in this list but approval is not used in my forums
Title: Re: Share user database for 2 (or more) different forums.
Post by: Deaks on January 27, 2008, 04:01:51 PM
Quote from: janilxx on January 07, 2008, 07:41:42 AM
Quote from: starbois on June 03, 2006, 11:18:16 PM
Did some tweaking and managed to get it to work on 1.1RC1. No guarantee

I have shared users between 2 forums with method described in this thread. I also made the changes described in quoted message to get registered user statistics for both forums.
There is problems with this change (click "Quote from"). After this change MANY setting changes goes to both forums.
If you want this change to affect only total and latest members, you should have this kind of if:
if (($variable != 'totalMembers') && ($variable != 'latestMember') && ($variable != 'latestRealName'))
{
    use old code
}
else
{
    use new code with 2 SQL statements
}

Also unapprovedMembers could be in this list but approval is not used in my forums

janilxx does this fix work?
Title: Re: Share user database for 2 (or more) different forums.
Post by: janilxx on January 28, 2008, 03:38:46 AM
Quote from: RunicWarrior on January 27, 2008, 04:01:51 PM
janilxx does this fix work?

At least it works in my tests. Unfortunately I still have to keep my other forum closed so at the moment I am using only one forum. Another forum opens after a while and then I will see how this really works.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Deaks on January 28, 2008, 02:06:11 PM
please keep us informed :)
Title: Re: Share user database for 2 (or more) different forums.
Post by: falguni1 on January 28, 2008, 10:46:37 PM
I think both these allow to share user database and create more smf forums in one database.

http://www.smfxxl.com/

http://demo.smfmultiforums.com/home.php
Title: Re: Share user database for 2 (or more) different forums.
Post by: SchismX on February 05, 2008, 10:42:38 PM
I have done the merger of the user base. I just have -one- 'small' problem.

I know that there is no easy way for this - but I figured I'd give it a shot and see what you all would suggest first hand.

I have a a few categories on Board1, and we shall say Board1 is just for random stuff, games and etc. Now on Board2, is going to be for more of the basic kind of RP online - board based of course.

Now, on Board1 (which was the original board to begin with) has a "category" with the RP board. I am wanting to move that RP board over to Board2..

I figure that it will require fooling with the SQL for smf_posts, smf_messages, & smf_topics -- though I thought I'd ask before diving into that headache.

Thanks in advance!
- David
Title: Re: Share user database for 2 (or more) different forums.
Post by: cjexotic on April 15, 2008, 08:37:03 PM
Quote from: falguni1 on January 28, 2008, 10:46:37 PM
I think both these allow to share user database and create more smf forums in one database.



http://demo.smfmultiforums.com/home.php

smfmultiforums will not do this

A few different people gave me the same options
So I asked and here's what they said

QuoteHere is the response made to your ticket. Please do not reply to this email directly, use the link aboveto reply. Our script is aimed to provide different forums for different people, so I afraid it will not help you to manage many your own forums, unless they all will be different one from another - with different users and all posts and topics.
Title: Re: Share user database for 2 (or more) different forums.
Post by: City Builder on April 17, 2008, 06:02:53 AM
Do my users have to login to every forum that I have seperately even though they are all sharing the same database as done in post 1 of this thread and all forums have been given the same cookie name.  Is that normal, I was under the impression that they could pass between forums without having to relogin on each forum
Title: Re: Share user database for 2 (or more) different forums.
Post by: City Builder on April 17, 2008, 07:12:14 AM
The only problems with this is they only support the upcoming 2.0 which Im still using tinyportal as my portal system which according to tiny portal they don't know when they will support 2.0 SMF, perhaps after a final has been released, so even if I setup my system with the beta versions of smf 2.0 I lose all portal functionality which we need right now unfortunately.  Personally I would have liked to have seen a built in portal function in SMF 2.0 AS An option.  Oh well, one can dream anyway.

Quote from: falguni1 on January 28, 2008, 10:46:37 PM
I think both these allow to share user database and create more smf forums in one database.

http://www.smfxxl.com/

http://demo.smfmultiforums.com/home.php
Title: Re: Share user database for 2 (or more) different forums.
Post by: City Builder on April 22, 2008, 09:59:18 AM
I'll ask this again, perhaps a bit clearer to see if I can get an answer
QuoteDo my users have to login to every forum that I have seperately even though they are all sharing the same database as done in post 1 of this thread and all forums have been given the same cookie name.  Is that normal, I was under the impression that they could pass between forums without having to relogin on each forum

As it is now, when a user registers on one of our forums, they are registered on all forums since they are using the common database.  However, if a user logs in on our main site (let's call it xx.com) and then goes to our subdomain forum at yy.com they need to login over there too.  Is there a way to make it so that no matter which site (either the main xx.com site or any of the subdomain forum sites) that they login to it will carry across to all the rest of the forum sites that we own.

Our structure can be looked at like this:

Main forum site: xxx.com
Subdomain forum yyy.xxx.com
Subdomain forum zzz.xxx.com

We would like it so that if they login at xxx.com and then move over to yyy.xxx.com they are still logged in or if they move then over to zzz.xxx.com they are still logged in as themselves, or if they start at zzz.xxx.com and login there, and then move over to the xxx.com site that they should still be logged in.

We have followed the instructions in the first message or two so things are working in the sence that no matter which site they attempt to register or login to, it will allow them to do so since it's using the same table.

I hope that's a bit clearer on what we're struggling with and need help with as our users are asking us why they have to login to each one of our subdomain forums when they already logged into one of the other ones.

Thanks very much for your time and help.
Title: Re: Share user database for 2 (or more) different forums.
Post by: assam_siddibapa on April 23, 2008, 01:55:38 AM
Can u say me how can i set up two forums on a single server ..... like member should not resignup for the other one ...... the same id must be able to use for both ....... like on on www.community.******.com and onther on www.forum.******.com ...... but both should be different
Title: Re: Share user database for 2 (or more) different forums.
Post by: City Builder on April 25, 2008, 03:52:09 PM
I got a PM from a user on one of my forums, and it took me a while to find what forum it was on since we have 12 of them running, and coincidently her PM was about not finding her Private Message even though at the top of all the different forums pages it said that she had one.  Turns out it was in our main forum.

So...  We need a way so that no matter what forum a user is on (we use one main forum at our domain name and 12 forums at subdomain names of the main domain), when they send out a PM to another user it needs to go to the main domain forum, and no matter what forum they are on when they have a PM, when they go to check it, it needs to take them to the main domain forum so that they can actually see their message instead of hunting around the 13 forums trying to find where they have a new PM at.

Can somebody please explain to me how this can be accomplished?

Thank you for your time.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Magic_Mike on May 05, 2008, 12:40:16 PM
Dont know how you xxl mod works but you can share the personal messages as
you share your member db.

I use one shared forum ( currently 5 forums ) same userdb and pm's...
but i missed the permissions ....damnd... ;)
Title: Re: Share user database for 2 (or more) different forums.
Post by: City Builder on May 05, 2008, 05:16:19 PM
Does anybody running more than one forum have any users complaining about the "show unread" not working properly on some of the forums?

I've got one particular user who keeps telling me that on one of our forums there are new posts but when she goes to the show unread for that forum it doesn't list any of the new messages.

Im not sure how that show unread actually works to begin with, Im guessing cookies and last visits but I don't know for sure, but is it possible that having all these sub domain forums that it could mess up the show unread from being accurate like if she logs into the main site for a visit, and there are new posts on our RPG forum but she doen't visit it, then comes back tommorrow and goes to the RPG forum and now it shows no new messages.  Is that possible because she didn't visit the RPG forum on the last visit so the messages are no longer considered new to her?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Spaceman-Spiff on May 05, 2008, 06:30:37 PM
I'm guessing this is caused by the value of 'last_login' column in members table. It will record your last login in any of the 2 forums, not separately. If the user goes from one forum to another right after, it won't be a problem. But when visiting the 2nd forum at a different time (example: the next day), SMF thinks he/she already visited the forum the day before, and only shows new posts in the last day.

A temporary solution is to create 2 fields and keep records for each forum separately.

Anyone has better idea?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Spaceman-Spiff on May 08, 2008, 03:01:11 PM
I just thought of a workaround for this issue. You should edit in the templates and replace the link to "action=unread" to "action=unread;all;start=0".

What this does is show all unread posts by that user.

The only drawback is that it may be a bit slower, uses 2 extra queries, but it's almost unnoticeable.
Title: Re: Share user database for 2 (or more) different forums.
Post by: djpaddystudio7 on May 21, 2008, 01:11:35 AM
Hi
I have had a forum for a long time and have added quite a few mods and manual modifications. So I couldn't update it further than 1.1.3 as it gave errors.
Now I look forward to installing  new forum with the same member base. So do you reckon there will be a problem if I use 1.1.5 for the new forum.
what are the tables that can not be shared between these versions.
Title: Re: Share user database for 2 (or more) different forums.
Post by: laydeehectic on May 29, 2008, 12:59:13 AM
Hi anguz why is your script even on the mods. There isnt even a download link. I should report.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Urbanite on July 03, 2008, 04:57:38 AM
What happens if I have two forums on same server with different sub domains and have the same database set up in admin/server settings on them both; will it not then share and update the content of this single database?

I am making this sound too simple perhaps  :-\
Title: Re: Share user database for 2 (or more) different forums.
Post by: jensvanherck on August 21, 2008, 04:18:44 AM
i have a question with this does it share the persons postcount 2?
Title: Re: Share user database for 2 (or more) different forums.
Post by: cdr_hayalet on August 31, 2008, 11:12:22 PM
Hello  i read all the post about that topic,but i couldn't see about my problem.
We are two friends,and we have got 2 forums.
We wanna share our member table.When we apply the first post,it is work.But i can be admin for my friends forum,and he can be admin my forums.What do i have to do for change it  ::)

Accutually i firstly think add a column to smf_member like Site_Id.But i dunno where does SMF know we are admin.I looking for it but i failed,and i am still looking for too.Bur if someone know,please say me.And if you know better soluation than mine,please say me.

Thank you for everything
/*hayalet*/
Title: Re: Share user database for 2 (or more) different forums.
Post by: cdr_hayalet on August 31, 2008, 11:13:53 PM
and i don't found download link that mod : http://custom.simplemachines.org/mods/?mod=41
if someone has got it please share with us.Bcuz another one didn't found it too like :S
Title: Re: Share user database for 2 (or more) different forums.
Post by: cdr_hayalet on September 01, 2008, 01:16:29 AM
sorry triple
but i solved my problem for 1.1.3.
if someone wanna i try to help
Title: Re: Share user database for 2 (or more) different forums.
Post by: KahneFan on September 06, 2008, 12:36:57 AM
(Should) this work in my case;

I currently have: mysite.com
And will be creating: myothersite.com , but it will actually be a mask of mysite.com/myothersite

Can I share a user db in this case, or will myother site being a sub of mysite mess things up? As far as cookies and all else is concerned, everything will see myothersite.com, but physically it will be in a sub.

And, to add to that, I may be creating: anothersite.com , which will also be a mask of mysite.com/anothersite

In short, can I use this to effectivly link

mysite.com
myothersite.com (masked from a sub)
anothersite.com (another masked sub)

But all using the same db.
Title: Re: Share user database for 2 (or more) different forums.
Post by: KahneFan on September 06, 2008, 04:00:18 AM
...it appears to work OK for my situation. However, I guess there's still not a fix for the member count to appear on all forums?
Title: Re: Share user database for 2 (or more) different forums.
Post by: brianjw on October 27, 2008, 10:53:31 AM
Hi,

I am having this same problem:
Quote from: Nic on October 26, 2004, 11:41:05 AM
Firstly, thanks SO much for this post - it was exactly what I needed.  I now have two forums for two sub-domains on the same site using one member table, which is just what I wanted.  however, I did notice one thing (no biggy, but wondered if I could fix it).  If someone registers on one forum, the member count automatically adds another one on, but on the other forum it doesn't and I have to tell it to recount the totals.  it's not a big hassle at the moment, since both forums are just new and not many people are registering, but if the forums get bigger it could be annoying having to recount totals each time a new member joins.  Is there any way around this?
and the fix for it was:
Quote from: [Unknown] on October 31, 2004, 05:41:46 AM
Find, Sources/Subs.php:

updateSettings(array(
'latestMember' => $latestmember,
'latestRealName' => $latestRealName,
'memberCount' => $memberCount,
'unapprovedMembers' => $unapprovedCount
));


Replace:
db_query("
REPLACE INTO prefix1_settings
VALUES ('latestMember', '$latestmember'),
('latestRealName', '$latestRealName'),
('memberCount', '$memberCount'),
('unapprovedMembers', '$unapprovedCount')", __FILE__, __LINE__);

db_query("
REPLACE INTO prefix2_settings
VALUES ('latestMember', '$latestmember'),
('latestRealName', '$latestRealName'),
('memberCount', '$memberCount'),
('unapprovedMembers', '$unapprovedCount')", __FILE__, __LINE__);


-[Unknown]

But I cannot find those codes for SMF 1.1.6. Can someone help me with it? Thanks.
Title: Re: Share user database for 2 (or more) different forums.
Post by: fyndler on October 30, 2008, 11:34:02 PM
Hi

Sorry but i dont get it i changed this "{$db_prefix}membergroups" => "smf1_membergroups" to this "{$db_prefix}brutalfpsforum00membergroups" => "smf1_membergroups"

And i get

Table 'brutalfpsforum00.smf_brutalfpsforum00_membergroups' doesn't exist
File: C:\xampp\htdocs\Sources\BoardIndex.php
Line: 293

haha what do i do wrong ?
Title: Re: Share user database for 2 (or more) different forums.
Post by: qubbah on November 28, 2008, 09:03:14 AM
i want only memberlist and their username in my sencondry forum. Thats member can acces new forum with same password.

How can i make it with minimun changed?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Beltazar_DSA on December 02, 2008, 11:20:06 PM
OMD.. LMAO..   so now, I have finally found this and that this could be done..   

Now, here would be the trick..   taking 3 separate forums    all running  SMF.1.1.7.  and Tiny Portal..   they all are under the same name domain w/ cept  /manor  /evolutions  and /dungeons              yeah, this is not going to happen anytime soon.. 

Title: Re: Share user database for 2 (or more) different forums.
Post by: MarkJ on December 04, 2008, 08:32:05 AM
This way of setting up multiple forums is great.  Only part that doesn't apply with the new forum software is this:

    updateSettings(array(
            'latestMember' => $latestmember,
            'latestRealName' => $latestRealName,
            'memberCount' => $memberCount,
            'unapprovedMembers' => $unapprovedCount
         ));


The new code is this:

       updateSettings(array('totalMembers' => true), true);
}
// If $parameter1 is false, and approval is off, we need change nothing.
elseif ($parameter1 !== false)
{
// Update the latest member (highest ID_MEMBER) and count.
$result = db_query("
SELECT COUNT(*), MAX(ID_MEMBER)
FROM smf_members", __FILE__, __LINE__);
list ($changes['totalMembers'], $changes['latestMember']) = mysql_fetch_row($result);
mysql_free_result($result);

// Get the latest member's display name.
$result = db_query("
SELECT realName
FROM smf_members
WHERE ID_MEMBER = " . (int) $changes['latestMember'] . "
LIMIT 1", __FILE__, __LINE__);
list ($changes['latestRealName']) = mysql_fetch_row($result);
mysql_free_result($result);
}

updateSettings($changes);
break;



I am not sure if that is the right code but it looks like it could be.  Anyone know how to alter it so that it updates like before?

Regards
Title: Re: Share user database for 2 (or more) different forums.
Post by: _Anthony_ on December 06, 2008, 09:14:16 PM
Can someone make this a mod please....
Title: Re: Share user database for 2 (or more) different forums.
Post by: brianjw on December 06, 2008, 10:05:11 PM
To make both sites update the counts instead of having to do it manually, use this for 1.1.7. Thanks to [SiNaN]/Blue Dream:

http://www.simplemachines.org/community/index.php?topic=271586.msg1829413#msg1829413
Title: Re: Share user database for 2 (or more) different forums.
Post by: cammy1568 on January 21, 2009, 02:51:10 AM
Hi, when i do this i cant register on the one i cahnged, i can only register on the main fourm. is there a way to fix this???
Title: Re: Share user database for 2 (or more) different forums.
Post by: cdr_hayalet on January 23, 2009, 05:45:38 PM
Quote from: KahneFan on September 06, 2008, 12:36:57 AM
(Should) this work in my case;

I currently have: mysite.com
And will be creating: myothersite.com , but it will actually be a mask of mysite.com/myothersite

Can I share a user db in this case, or will myother site being a sub of mysite mess things up? As far as cookies and all else is concerned, everything will see myothersite.com, but physically it will be in a sub.

And, to add to that, I may be creating: anothersite.com , which will also be a mask of mysite.com/anothersite

In short, can I use this to effectivly link

mysite.com
myothersite.com (masked from a sub)
anothersite.com (another masked sub)

But all using the same db.
i think you can do this absolutly.Bcuz i cant see any stuff to block what you want.Just you must be careful when you are editing your cookie name.It must be the same for your everysite.
EDIT//btw in your second message,you said there wasnt.But there is.If you read the first pages you will see how to solve.and i solved it too...
Title: Re: Share user database for 2 (or more) different forums.
Post by: cdr_hayalet on January 23, 2009, 05:52:18 PM
Quote from: fyndler on October 30, 2008, 11:34:02 PM
Hi

Sorry but i dont get it i changed this "{$db_prefix}membergroups" => "smf1_membergroups" to this "{$db_prefix}brutalfpsforum00membergroups" => "smf1_membergroups"

And i get

Table 'brutalfpsforum00.smf_brutalfpsforum00_membergroups' doesn't exist
File: C:\xampp\htdocs\Sources\BoardIndex.php
Line: 293

haha what do i do wrong ?
dude you must change your membergroup prefix like this "main_membersgroup" :)
you must look again how to write "membersgroup" and after if it is ryt,you must check how did you change it in your smf files.You must keep it the same for your all forums :)
Title: Re: Share user database for 2 (or more) different forums.
Post by: cdr_hayalet on January 23, 2009, 05:54:56 PM
Quote from: qubbah on November 28, 2008, 09:03:14 AM
i want only memberlist and their username in my sencondry forum. Thats member can acces new forum with same password.

How can i make it with minimun changed?
if you ask me you must change this tables:
members
i m not sure,i didnt try but i think this table is enough.a few time ago i checked my changed tables list.And according to me thats enough.
Title: Re: Share user database for 2 (or more) different forums.
Post by: cdr_hayalet on January 23, 2009, 05:56:55 PM
Quote from: cammy1568 on January 21, 2009, 02:51:10 AM
Hi, when i do this i cant register on the one i cahnged, i can only register on the main fourm. is there a way to fix this???
you made mistake,i think.bcuz noone has like yours problem.if you check your steps you will see.
Title: Re: Share user database for 2 (or more) different forums.
Post by: bburg5 on February 01, 2009, 07:51:28 PM
I edited my files and now I get this error- "Table 'ffwaterf_Forum.smf2_members' doesn't exist" what is wrong with this?

Thanks
Title: Re: Share user database for 2 (or more) different forums.
Post by: brianjw on February 01, 2009, 11:42:07 PM
Does that table actually exist?
Title: Re: Share user database for 2 (or more) different forums.
Post by: bburg5 on February 02, 2009, 10:10:35 AM
I do not know what file to locate it in...

I tried the URL again and still getting the "Table 'ffwaterf_Forum.smf2_memberss' doesn't exist" error and the forum does not load.

I only changed the files on the first post. What would have caused this?


Does the source files in both forums have to be changed to match or just having the prefix set to smf1_ in the main forum good enough. I only change the second forum to say smf1_ in the appropriate files?

Thanks
Title: Re: Share user database for 2 (or more) different forums.
Post by: bburg5 on February 07, 2009, 12:47:50 PM


I chaned the files to reflect
$db_members= smf_2_members

and so on with the othe files- This is the correct file changes, right?

Thanks
Title: Re: Share user database for 2 (or more) different forums.
Post by: cdr_hayalet on February 07, 2009, 01:14:50 PM
Quote from: bburg5 on February 07, 2009, 12:47:50 PM
Here are my DB files;

########## Database Info ##########
-------edited-------

I chaned the files to reflect
$db_members= smf_2_members

and so on with the othe files- This is the correct file changes, right?

Thanks
dude these are special stuff for your site.Pls hide and change :).Anyone can know this stuff from here,and maybe hack your site :) be more carrefully.
And your question's answer is that you must change your table name "smf2_memberss".Probably it must be "main_members".Try and report i ll try to solve if it is wrong.
Title: Re: Share user database for 2 (or more) different forums.
Post by: KahneFan on February 07, 2009, 01:47:54 PM
Quote from: cdr_hayalet on February 07, 2009, 01:14:50 PM
dude these are special stuff for your site.Pls hide and change :).Anyone can know this stuff from here,and maybe hack your site :) be more carrefully.
And your question's answer is that you must change your table name "smf2_memberss".Probably it must be "main_members".Try and report i ll try to solve if it is wrong.

I agree with cdr, you need to remove/edit this information as it is the heart of your site. Also, cdr, PLEASE REMOVE YOUR QUOTE since the OP can't edit your quote the information will remain there unless you or a mod removes it.
Title: Re: Share user database for 2 (or more) different forums.
Post by: cdr_hayalet on February 07, 2009, 02:01:11 PM
Ok KahneFan i did ,but bburg5 must do it too.it is more important :).
Title: Re: Share user database for 2 (or more) different forums.
Post by: bburg5 on February 08, 2009, 03:49:51 PM
Thanks, I didn't think about that before I posted. I just thought the more info given the better someone could help me.

I deleted the site as it is new and will start two others with different information. I just seems as I enter the information from the first post, I only get errors. I will try again
Title: Re: Share user database for 2 (or more) different forums.
Post by: cdr_hayalet on February 08, 2009, 04:48:12 PM
you must try what i advised you :)
Title: Re: Share user database for 2 (or more) different forums.
Post by: bburg5 on February 08, 2009, 07:53:51 PM
I continue to get this error and the page will not load-

Table 'ffwaterf_waterfowl.main_members' doesn't exist- do I need to have {} around main in all my changes?

Thanks
Title: Re: Share user database for 2 (or more) different forums.
Post by: cdr_hayalet on February 14, 2009, 01:21:16 PM
hmm.
you can do this like this i think
1-)go to phpmyadmin
2-)find the {$prefix}members-->it must be smf_members or like this...
3-)Click the structers on it
4-)go to Operatings
5-)Rename the table like "main_members"
6-)get a coffee yourself :p
:) try and report me if it isn't work too we try to find another way.
Title: Re: Share user database for 2 (or more) different forums.
Post by: bburg5 on February 14, 2009, 04:23:25 PM
I tried the change and get nowhere. Just errors. I deleted the second forum and reloaded it to the same database with different prefix.

This is what I have-
Main Forum prefix-   $db_prefix = 'main';
Second Forum prefix-   $db_prefix = 'main_';

I changed the second forum to read $db_prefix = 'main'; but get an error in phpmyadmin stating it already exsists. Is this not what I am supposed to do?

I just want to get the second forum to mirror the main forum tables without getting so you do not have to reg. for both forums.

It apperas that I am making this more difficult than it should be...

Thanks
Title: Re: Share user database for 2 (or more) different forums.
Post by: TheDisturbedOne on February 17, 2009, 12:27:22 PM
Does anybody know if this will work if I bridge a 1.1.8 with a 2.0 RC 1?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Stef001 on February 23, 2009, 05:22:49 PM
I have the following problem:
I get in the schoutbox, "No database selected".
(see screenshot)
I know that the shoutbox don`t use the database.
In the Log i get this message:
http://www.kaartenleggen.nl/zigeunerkaarten/index.php?yshout&amp;action=admin

: No database selected


SELECT mem.*, IFNULL(a.id_attach, 0) AS id_attach, a.filename, a.attachment_type
FROM smf_members AS mem
LEFT JOIN smf_attachments AS a ON (a.id_member = 2)
WHERE mem.id_member = 2
LIMIT 1

Bestand: /home/kaarten/domains/kaartenleggen.nl/public_html/zigeunerkaarten/Sources/Load.php
Regel: 350


When i refresh the page i see for one second the shoutbox and than i get the mesage.


I figured out that it had someting to do with SSI.php.

I have shared the user database from two forums.

Please some help.

Stef.

(http://www.kaartenleggen.nl/zigeunerkaarten/screenshot.gif)
Title: Re: Share user database for 2 (or more) different forums.
Post by: tehdisco on February 24, 2009, 02:14:43 AM
i managed to share my Databases, but i cant seem to get the same theme to stick on both sites.
When I set the theme to my preferred one on one instance, the other switches to default, then when i try and switch it from the default to my preferred theme on that one, instance one goes to default. Please help.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Angelotus on March 03, 2009, 04:01:51 AM
^^ Your theme has an ID number. That is set in your member tables. If you select theme ID 6 in the first forum, it will also be set as ID for the other one. And if there is no ID 6 in the other one, it will set to default automatically.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Angelotus on March 03, 2009, 09:15:08 AM
My problem is that I can't login on the second SMF forum, but only on the original first one (where the member table exists).
I get an error that says: Please try again.
How can this be solved???
Title: Re: Share user database for 2 (or more) different forums.
Post by: heinandar on March 09, 2009, 09:19:59 AM
Hello all..
I have 2 sites. http://forum1.com and http://forum1.net
can i share forum1.com's  the whole database to forum1.net. i can access cpanel and the two sites are hosted on same hosting.
pls think for me.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Giiyom on March 16, 2009, 10:28:43 PM
If one of the 2 forums has already been created, is it still possible to share his DB?
Title: Re: Share user database for 2 (or more) different forums.
Post by: bburg5 on March 17, 2009, 10:10:44 AM
Yes!

As long as the two forums are installed in the same DB. You just need to share the groups that you want from the first post.  :D
Title: Re: Share user database for 2 (or more) different forums.
Post by: Darkness_ on March 18, 2009, 06:34:27 AM
I have my main forum at forum1.com and forum2.com
It's on the same server, it shares the whole database the cookies to :S but when you log out in one of them it doesn't do that at the other.
How could this be fixed?
both using cookie11
Title: Re: Share user database for 2 (or more) different forums.
Post by: Angelotus on March 18, 2009, 07:09:57 AM
Have you also share the session db?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Darkness_ on March 18, 2009, 10:58:14 AM
they are using the same whole DB.
Only the domain is different xxxxxx.com & zzzzzzz.com

Session DB is that somewhere else then the forum DB?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Angelotus on March 18, 2009, 05:02:44 PM
If it uses the whole db, why? Why not redirect one domain to the other???
Title: Re: Share user database for 2 (or more) different forums.
Post by: Darkness_ on March 19, 2009, 02:54:26 PM
The home domain wil be the forum
and the second domain is the index of smf media gallery.

My forums name is amenna
and for the part of se media gallery it wil be
amennArt that's the reason why sharing the whole database.

But I want it to be like if you log out at Amenna (forum) the user wil be logged out of AmennArt to
Title: Re: Share user database for 2 (or more) different forums.
Post by: onscene.co.uk on March 22, 2009, 11:17:46 AM
have followed this to the letter but now when i click onto the second forum, it is giving me

Connection Problems
Sorry, SMF was unable to connect to the database. This may be caused by the server being busy. Please try again later.

any idea's what i've not done right???
Title: Re: Share user database for 2 (or more) different forums.
Post by: cdr_hayalet on March 29, 2009, 04:19:20 PM
Quote from: bburg5 on February 14, 2009, 04:23:25 PM
I tried the change and get nowhere. Just errors. I deleted the second forum and reloaded it to the same database with different prefix.

This is what I have-
Main Forum prefix-   $db_prefix = 'main';
Second Forum prefix-   $db_prefix = 'main_';

I changed the second forum to read $db_prefix = 'main'; but get an error in phpmyadmin stating it already exsists. Is this not what I am supposed to do?

I just want to get the second forum to mirror the main forum tables without getting so you do not have to reg. for both forums.

It apperas that I am making this more difficult than it should be...

Thanks
ups,bro attention your prefix.It must be like that "main1_"  and "main_2"
i advise you to make it from begging.It will be more easy for you.
Title: Re: Share user database for 2 (or more) different forums.
Post by: cdr_hayalet on March 29, 2009, 04:21:00 PM
Quote from: TheDisturbedOne on February 17, 2009, 12:27:22 PM
Does anybody know if this will work if I bridge a 1.1.8 with a 2.0 RC 1?
i dont think it is gonna work.Cause their data tables are very diffirent.
Title: Re: Share user database for 2 (or more) different forums.
Post by: azn_romeo_4u on May 18, 2009, 04:25:26 PM
I'm starting to work on this new on two brand new forums.  I'm using two different domains

http://www.mydragonica.net and http://www.lunaheroes.com  both mmorpg's.  SMF seems to be the best for sharing users and db's so i am going with smf

I hope this succeeds even a little bit.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Mraza on June 16, 2009, 07:07:53 AM
hello i was able to install 2nd forum and share only members, membergroups, themes and attachments tables but i can't find these syntex :
{$db_prefix}im_recipients
{$db_prefix}instant_messages

and i cant find the updateSettings(array in subs.php     ...please any help

Edit: and when i post on my second forum i can see the topic has been posted but when i click to show the content i  got this error "This topic doesn't exist on this board. " and in my forum stats i got this :

Latest Post: "" ( )

Edit: More discussion at  here (http://www.simplemachines.org/community/index.php?topic=318106.0)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Nimras on June 22, 2009, 12:14:27 PM
Okay so if i just want it so people registeret are on all forums, with username and password so they dont have to rereg everywhere and only has to upload avy and make a sig one place and it is updated everywhere, the rest are managed purely by each forum them self from themes to the other settings.

And also i dont want the other forums to see a user is online as a guest or as the user them self unless they are logged in on that very forum would i need to do much beside these few changes?? as i want each forum to handle their own mods and so on it is just users and their sig plus avy i want to share, post counts, what they have access to is managed individual by each forum meaning if they reg and log into a forum they dont have access to they wont get it.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Mraza on June 22, 2009, 05:44:26 PM
Quote from: Nimras on June 22, 2009, 12:14:27 PM
Okay so if i just want it so people registeret are on all forums, with username and password so they dont have to rereg everywhere and only has to upload avy and make a sig one place and it is updated everywhere, the rest are managed purely by each forum them self from themes to the other settings.

And also i dont want the other forums to see a user is online as a guest or as the user them self unless they are logged in on that very forum would i need to do much beside these few changes?? as i want each forum to handle their own mods and so on it is just users and their sig plus avy i want to share, post counts, what they have access to is managed individual by each forum meaning if they reg and log into a forum they dont have access to they wont get it.
you need to share  members, membergroups, themes and attachments tables. for this in your Source directory find these tables and change it to your first forum prefix ..for example if your prefix is smf1_ so for members find  " {$db_prefix}members " and change it to " smf1_members" without quotes and so on...
Title: Re: Share user database for 2 (or more) different forums.
Post by: Nimras on June 22, 2009, 06:55:28 PM
Quote from: mraza on June 22, 2009, 05:44:26 PM
Quote from: Nimras on June 22, 2009, 12:14:27 PM
Okay so if i just want it so people registeret are on all forums, with username and password so they dont have to rereg everywhere and only has to upload avy and make a sig one place and it is updated everywhere, the rest are managed purely by each forum them self from themes to the other settings.

And also i dont want the other forums to see a user is online as a guest or as the user them self unless they are logged in on that very forum would i need to do much beside these few changes?? as i want each forum to handle their own mods and so on it is just users and their sig plus avy i want to share, post counts, what they have access to is managed individual by each forum meaning if they reg and log into a forum they dont have access to they wont get it.
you need to share  members, membergroups, themes and attachments tables. for this in your Source directory find these tables and change it to your first forum prefix ..for example if your prefix is smf1_ so for members find  " {$db_prefix}members " and change it to " smf1_members" without quotes and so on...

Also when i only want users to reg one time then they can log in every where, the sig and avy are shared. REST should not be shared. Themes, groups and so on. only thing that is are the users so they can log in everywhere and dont have to reg every forum and set up avy and sig all place. Everything else i want to be not shared, ranks member groups and so on should not be shared what they have of rank and membergroup or access in forum a should not be shared with forum b there he can have another rank and membergroup access, as said only thing i want for easier work is that login and reg means they are able to login everywhere when registret and their sig and avy are shared so they dont have to redo that, but every thing else from other settings and post counts what ever does not follow over. offcourse a permban one place follow over but i mean i want everything else to be strictly for the other forums.

As we will make a flash intro where registrering and loging in can be done from and then they can move to a forum or read more hence i want this. if you get me??
Title: Re: Share user database for 2 (or more) different forums.
Post by: Tyilanmenyn on June 24, 2009, 08:10:37 AM
Can someone plz make an simple small guide on how to do this with 2.0 RC1-1?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Mraza on June 25, 2009, 03:39:00 PM
Quote from: Tyilanmenyn on June 24, 2009, 08:10:37 AM
Can someone plz make an simple small guide on how to do this with 2.0 RC1-1?
In few days i will make a complete guide for this....just hold on ;)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Nimras on June 25, 2009, 04:53:13 PM
Quote from: mraza on June 25, 2009, 03:39:00 PM
Quote from: Tyilanmenyn on June 24, 2009, 08:10:37 AM
Can someone plz make an simple small guide on how to do this with 2.0 RC1-1?
In few days i will make a complete guide for this....just hold on ;)

Good but if i just want all users to log in once and reg once to have access to all areas plus setup sig and avy one place for it to be everywhere and then nothing else should be shared as i want each forum to be 100% on their own with mods, rights and groups would that be possible easy??
Title: Re: Share user database for 2 (or more) different forums.
Post by: Tyilanmenyn on June 25, 2009, 05:01:06 PM
Quote from: mraza on June 25, 2009, 03:39:00 PM
Quote from: Tyilanmenyn on June 24, 2009, 08:10:37 AM
Can someone plz make an simple small guide on how to do this with 2.0 RC1-1?
In few days i will make a complete guide for this....just hold on ;)

Once you're done, let me know :)
Thanks in advance
Title: Re: Share user database for 2 (or more) different forums.
Post by: Özgür on July 05, 2009, 08:40:23 PM
How can share smileys ?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Acans on August 09, 2009, 03:54:51 AM
What file is this step in?

Show unread may not work when moving from one forum to another
You should edit in the templates and replace the link to "action=unread" to "action=unread;all;start=0". What this does is show all unread posts by that user.
Title: Re: Share user database for 2 (or more) different forums.
Post by: _Anthony_ on November 11, 2009, 02:06:53 AM
Quote from: Daydreamer on July 05, 2009, 08:40:23 PM
How can share smileys ?
If I'm not mistaken you would probably have to have the images on both forums.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on November 11, 2009, 07:18:36 AM
And the database entries too...
Title: Re: Share user database for 2 (or more) different forums.
Post by: mcgiwer on November 11, 2009, 10:07:15 AM
Here is my solution with allows to easier to manage the prefixes with one time source modification.

== Part 1 ==

Settings.php

FIND:


$db_prefix = "en_";


ADD AFTER:


$db_prefix1 = "shared_";
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on November 11, 2009, 10:08:41 AM
Question before you go any further: are you also updating the updateDBsettings and similar functions?
Title: Re: Share user database for 2 (or more) different forums.
Post by: mcgiwer on November 12, 2009, 05:52:37 AM
Quote from: Arantor on November 11, 2009, 10:08:41 AM
Question before you go any further: are you also updating the updateDBsettings and similar functions?

All code will get updated... As I had wrotten, It's the part 1 of the changes
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on November 12, 2009, 09:14:14 AM
You're missing what I asked. Updating the Settings.php file is fine but you SHOULD NOT do it manually because when the user changes anything in there - including maintenance mode - the entire file is rebuilt from scratch. Thus I wanted to know if you'd updated the routine that adds values there.
Title: Re: Share user database for 2 (or more) different forums.
Post by: mcgiwer on November 13, 2009, 09:38:53 AM
Quote from: Arantor on November 12, 2009, 09:14:14 AM
You're missing what I asked. Updating the Settings.php file is fine but you SHOULD NOT do it manually because when the user changes anything in there - including maintenance mode - the entire file is rebuilt from scratch. Thus I wanted to know if you'd updated the routine that adds values there.

Did you missed my answer? I had wrotten that all source files will get updated
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on November 13, 2009, 09:56:38 AM
I saw that. I'm merely pointing out that updateSettings is often overlooked in such things.
Title: Re: Share user database for 2 (or more) different forums.
Post by: mcgiwer on November 13, 2009, 11:18:52 AM
I will post next part after edition
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on December 09, 2009, 04:57:55 PM
Anyone use doing this for smf 2.0 rc2?
Title: Re: Share user database for 2 (or more) different forums.
Post by: mcgiwer on December 09, 2009, 05:52:30 PM
Quote from: Abu Fahim Ismail on December 09, 2009, 04:57:55 PM
Anyone use doing this for smf 2.0 rc2?

I am, but I got temporary busy with preparation to company registration
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on December 09, 2009, 07:10:18 PM
Quote from: mcgiwer on December 09, 2009, 05:52:30 PM
Quote from: Abu Fahim Ismail on December 09, 2009, 04:57:55 PM
Anyone use doing this for smf 2.0 rc2?

I am, but I got temporary busy with preparation to company registration
Can you provide some guide especially in Subs.php file? Thanks.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Ammoratti on January 04, 2010, 02:27:56 AM
I've followed instructions (and updates) given throughout this thread using v1.1.11, and things seem to be working beautifully.  Two SMF installations are sharing the same user table. Both forums share the same user listing, and login sessions persist between forums (when a user logs into one, he's logged onto both/logs off one, he's logged off both).

Here's an idea of how things are set up:

Original Forum: private.site.com
Second Forum: www.site.com/forum   <--intended to be the "public" forum.

However, there seems to be a conflict with membergroup assignments between the two forums.  As soon as an Admin configures membergroup assignments on one forum, those changes end up interfering with the membergroup settings on the other. 

If I restore the original variable to all membergroups prefixes in my source files ("smf1_membergroups" => "{$db_prefix}membergroups"), will this grant me the ability to manage independent membergroup listings for each SMF installation while sharing user lists?  Or, will this break something?

Thanks in advance, and I'm open to suggestions.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on January 04, 2010, 02:37:26 AM
Quote from: Ammoratti on January 04, 2010, 02:27:56 AM
If I restore the original variable to all membergroups prefixes in my source files ("smf1_membergroups" => "{$db_prefix}membergroups"), will this grant me the ability to manage independent membergroup listings for each SMF installation while sharing user lists?  Or, will this break something?

No it won't because the list of membergroups is a set of columns in the members table. You need to create a separate ID_GROUP, ID_POST_GROUP and additionalGroups columns (called something else) and have one of the installations reflect those columns instead. (Just take a look at how many changes that impacts though...)
Title: Re: Share user database for 2 (or more) different forums.
Post by: gitchuone on February 17, 2010, 01:00:46 AM
Did this thread die?

Sorry to reopen it if so.

Maybe what I am trying to do is impossible, as it's just coming to me.

I followed the instructions from the beginning, and when I updated ALL THE .PHP files from /Sources and reloaded them to the second forum installation, I started getting database errors that my user didn't exist. That makes sense now because my Forum1 (where I have all my users established) is SMF 1.1.11, and my Forum2 (where I want to use all the members from Forum1) is SMF 2.0 RC2.

Am I right in believing that is the issue?

Or, am I just completely off base?

Wasn't someone going to compile all this info with updated versions?
Title: Re: Share user database for 2 (or more) different forums.
Post by: David111567 on February 18, 2010, 12:41:38 PM
Quote from: gitchuone on February 17, 2010, 01:00:46 AM
Did this thread die?

Sorry to reopen it if so.

Maybe what I am trying to do is impossible, as it's just coming to me.

I followed the instructions from the beginning, and when I updated ALL THE .PHP files from /Sources and reloaded them to the second forum installation, I started getting database errors that my user didn't exist. That makes sense now because my Forum1 (where I have all my users established) is SMF 1.1.11, and my Forum2 (where I want to use all the members from Forum1) is SMF 2.0 RC2.

Am I right in believing that is the issue?

Or, am I just completely off base?

Wasn't someone going to compile all this info with updated versions?


it stands to reason...and common sense would DICTATE that you should be using the same versions of SMF for BOTH.....for this to work.
Title: Re: Share user database for 2 (or more) different forums.
Post by: mkmeister on February 18, 2010, 01:14:15 PM
I did this very same thing, but in a much easier way and without changing code by just using mysql.

Say you have two forums with the prefixes forum1_ and forum2_.

All you do is make a copy of one of the tables that you want to share. Then for those prefixes, you just create a view in mysql by the same name of the shared table.

So for example, in the end, you'd end up with the real members table at something like 'shared_members'.
Then for the two different forums, you'd do something like this in mysql:
CREATE VIEW forum1_members AS SELECT * FROM shared_members;
CREATE VIEW forum2_members AS SELECT * FROM shared_members;

Clean, simple, and no big code changes.
Title: Re: Share user database for 2 (or more) different forums.
Post by: gitchuone on February 19, 2010, 02:01:22 AM
Quote from: mkmeister on February 18, 2010, 01:14:15 PM
I did this very same thing, but in a much easier way and without changing code by just using mysql.

Say you have two forums with the prefixes forum1_ and forum2_.

All you do is make a copy of one of the tables that you want to share. Then for those prefixes, you just create a view in mysql by the same name of the shared table.

So for example, in the end, you'd end up with the real members table at something like 'shared_members'.
Then for the two different forums, you'd do something like this in mysql:
CREATE VIEW forum1_members AS SELECT * FROM shared_members;
CREATE VIEW forum2_members AS SELECT * FROM shared_members;

Clean, simple, and no big code changes.

The _members table from 1.1.11 has the same structure as the table from 2.0 RC2, so it "shouldn't" make a difference as far as I can tell.

The rest of the internets aren't giving me any solution as I guess it's obscure to try and import a single from a database into another table of the same database. Dunno.

I used part of the example that I've quoted and have received the error as such:

mysql> create view smf2_members as select * from smf_members;
ERROR 1050 (42S01): Table 'smf2_members' already exists

There IS content in the "existing" table 'smf2_members' but what I would be hoping for is some sort of "force" to allow the content from smf_members to just overwrite what is in smf2_members.

Ain't happenin' yet.
Title: Re: Share user database for 2 (or more) different forums.
Post by: mkmeister on February 19, 2010, 12:08:18 PM
Quote from: gitchuone on February 19, 2010, 02:01:22 AM
Quote from: mkmeister on February 18, 2010, 01:14:15 PM
I did this very same thing, but in a much easier way and without changing code by just using mysql.

Say you have two forums with the prefixes forum1_ and forum2_.

All you do is make a copy of one of the tables that you want to share. Then for those prefixes, you just create a view in mysql by the same name of the shared table.

So for example, in the end, you'd end up with the real members table at something like 'shared_members'.
Then for the two different forums, you'd do something like this in mysql:
CREATE VIEW forum1_members AS SELECT * FROM shared_members;
CREATE VIEW forum2_members AS SELECT * FROM shared_members;

Clean, simple, and no big code changes.

The _members table from 1.1.11 has the same structure as the table from 2.0 RC2, so it "shouldn't" make a difference as far as I can tell.

The rest of the internets aren't giving me any solution as I guess it's obscure to try and import a single from a database into another table of the same database. Dunno.

I used part of the example that I've quoted and have received the error as such:

mysql> create view smf2_members as select * from smf_members;
ERROR 1050 (42S01): Table 'smf2_members' already exists

There IS content in the "existing" table 'smf2_members' but what I would be hoping for is some sort of "force" to allow the content from smf_members to just overwrite what is in smf2_members.

Ain't happenin' yet.

You'd have to move the current table first.

ALTER TABLE prefix_members RENAME TO prefix_members_backup;

All your data will still be in prefix_members_backup in case you need to use it.

Is that the main data you'd like to share with the other forums? If so you can just use that as your main shared table, rename it to something like shared_members and create the view based on that instead. Otherwise, you'll have to merge all the data from the various forums tables into the one shared table to insure unique IDs don't cross, and that can be tricky depending on how many tables you want shared that use that members tables data.

The next step I'm doing is sharing the same login session. I'll let you know if I get around to that and what I do. It's more difficult because the different forums are at completely different domains, so I can't just write an additional/global cookie or anything... I was able to hijack the login though by using the same cookie at another domain, which concerned me a little. Anyway, that's another topic for another day.
Title: Re: Share user database for 2 (or more) different forums.
Post by: GrassrootsPA on February 28, 2010, 03:17:18 AM
I'm a SMF newbie running 2.0 RC2 and must admit the directions above are a bit over my head.

Just wanted to voice support for those that are skilled to figure out an easier way to share 2 forums installed on the same database, or at the VERY VERY least a shared login.

I am confused why a shared login cannot be implemented (so someone doesn't need to register for 2 different forums) if the tables are on the same database...wouldn't this be easy to pull off?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on March 01, 2010, 10:20:53 AM
Quote from: GrassrootsPA on February 28, 2010, 03:17:18 AM
I'm a SMF newbie running 2.0 RC2 and must admit the directions above are a bit over my head.

Just wanted to voice support for those that are skilled to figure out an easier way to share 2 forums installed on the same database, or at the VERY VERY least a shared login.

I am confused why a shared login cannot be implemented (so someone doesn't need to register for 2 different forums) if the tables are on the same database...wouldn't this be easy to pull off?
Why dont you use multiple forum mod instead? It is easier.
Title: Re: Share user database for 2 (or more) different forums.
Post by: GrassrootsPA on March 01, 2010, 01:03:59 PM
Hey Abu,

I tried that but have been unable to get it to work. (There seems to be some bug in it. Plus isn't not exactly what I'm looking for)

In general, I'm blown away by how wonderful SMF is, but the one thing that I do not like is how difficult it seems to be to share login info for 2 forums installed on the same database (with different table prefixes, etc).

From a newbie's perspective, I assumed it would be pretty easy to have a universal login if 2 installs shared the same db, but I am finding out I thought wrong!

(In a perfect world I want to have 2 forums on separate domains with the same login)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on March 01, 2010, 06:07:30 PM
Quote from: GrassrootsPA on March 01, 2010, 01:03:59 PM
Hey Abu,

I tried that but have been unable to get it to work. (There seems to be some bug in it. Plus isn't not exactly what I'm looking for)

In general, I'm blown away by how wonderful SMF is, but the one thing that I do not like is how difficult it seems to be to share login info for 2 forums installed on the same database (with different table prefixes, etc).

From a newbie's perspective, I assumed it would be pretty easy to have a universal login if 2 installs shared the same db, but I am finding out I thought wrong!

(In a perfect world I want to have 2 forums on separate domains with the same login)
Are you sure? It seems easy to me. Is the multiple forum mod that you are referring too? http://custom.simplemachines.org/mods/index.php?mod=2137

Well, I too think that sharing database should be made easy. However, it is not (not yet?) with smf. May be there will be in the near future. But I do think others (here in smf) can guide you there, if you really want to learn for it.
Title: Re: Share user database for 2 (or more) different forums.
Post by: GrassrootsPA on March 01, 2010, 06:28:26 PM
Thanks Abu: Yes, that's the mod I have been having an issue with (duplicate characters in the location address ending get created)

But even if I could get that installed it is not exactly what I'm trying to do.

I want to have two separate installs on two different domains sharing the same database.

Example:
DomainA.com (forum in that root)
DomainB.com (forum in that root)

Someone signs up on DomainA.com's forum? BLAM, they can login to DomainB.com's forum if they want.

Hope this helps explain what I would ultimately like to do!
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on March 01, 2010, 06:39:14 PM
Quote from: GrassrootsPA on March 01, 2010, 06:28:26 PM
Thanks Abu: Yes, that's the mod I have been having an issue with (duplicate characters in the location address ending get created)

But even if I could get that installed it is not exactly what I'm trying to do.

I want to have two separate installs on two different domains sharing the same database.

Example:
DomainA.com (forum in that root)
DomainB.com (forum in that root)

Someone signs up on DomainA.com's forum? BLAM, they can login to DomainB.com's forum if they want.

Hope this helps explain what I would ultimately like to do!
Yes, this thread is the right mod for you. But you have to make manual modifications. It is quite easy to do for 1.1.x but not so for 2.0 RCx. You can try but there are a lot of files that need changes.
Title: Re: Share user database for 2 (or more) different forums.
Post by: GrassrootsPA on March 01, 2010, 06:44:02 PM
Wow, this is great news. Maybe when RC3 comes out and some bugs are worked out it will be able to be done  :D
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on March 01, 2010, 06:47:23 PM
As advised in the earlier posts, you might need a good software to do all the necessary changes. Good luck!
Title: Re: Share user database for 2 (or more) different forums.
Post by: mkmeister on March 04, 2010, 03:35:19 PM
OK, here's a step by step of exactly what I did. There were ZERO code changes, and only used MySQL to pull it off as noted in a previous post.

As a note, I'm using SMF 1.1.11 and MySQL 5.0.x. If SMF 2.x uses a similar table structure (haven't looked at it personally yet), I'd imagine it'd work just as well and still no code changes. They don't even need to be on the same database, but it's easier, and my instructions will assume they're using the same database with just different prefixes for the two (or more) installations of SMF. It does not matter what domain they are hosted on as long as they use the same MySQL server.

This will share user logins and PMs.

Assume you have two installations. One is an already established forum installation, and it uses the prefix "forumA_". The other is a new forum that you want to share forumA's logins and PMs. It has the prefix "forumB_". They're both in the database called "smf".

Log onto MySQL. There are a variety of tools for this but I just use commandline.
Now, once in MySQL, issue the following.
USE smf;

First, just move forumB's tables you want shared out of the way.
ALTER TABLE forumB_members RENAME TO forumB_members_old;
ALTER TABLE forumB_personal_messages RENAME TO forumB_personal_messages_old;
ALTER TABLE forumB_pm_recipients RENAME TO forumB_pm_recipients_old;


WARNING: Your forumA install will NOT be accessible once you do the following step until all steps are complete. It'd be wise to make a backup first too.
Next, rename forumA's tables to use a "shared_" prefix.
ALTER TABLE forumA_members RENAME TO shared_members;
ALTER TABLE forumA_personal_messages RENAME TO shared_personal_messages;
ALTER TABLE forumA_pm_recipients RENAME TO shared_pm_recipients;


Finally, create views of the shared tables for both forumA and forumB so they see the exact same tables and the info is the same for both.
First, forumA:
CREATE VIEW forumA_members AS SELECT * FROM shared_members;
CREATE VIEW forumA_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW forumA_pm_recipients AS SELECT * FROM shared_pm_recipients;


And next, forumB:
CREATE VIEW forumB_members AS SELECT * FROM shared_members;
CREATE VIEW forumB_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW forumB_pm_recipients AS SELECT * FROM shared_pm_recipients;


Presto! Finished! Both forumA and forumB share users and PMs!

If anybody can spot corrections or something wrong with the above instructions, let me know and I'll correct it.

EDIT: Corrected a couple of typos.
Title: Re: Share user database for 2 (or more) different forums.
Post by: GrassrootsPA on March 04, 2010, 09:27:44 PM
mkmeister,

Three 'dumb' questions from a SMF newbie:  ;)

1) Are you using phpMyAdmin for the MYSQL edits?

2) One can do this sharing for 3 or more databases as well (not just two), right?

3) Would it be possible for someone to create a mod that does this sharing? (I personally am uncomfortable messing around with MYSQL tables and would prefer a mod, if possible)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on March 05, 2010, 07:13:04 AM
Quote from: mkmeister on March 04, 2010, 03:35:19 PM
OK, here's a step by step of exactly what I did. There were ZERO code changes, and only used MySQL to pull it off as noted in a previous post.

As a note, I'm using SMF 1.1.11 and MySQL 5.0.x. If SMF 2.x uses a similar table structure (haven't looked at it personally yet), I'd imagine it'd work just as well and still no code changes. They don't even need to be on the same database, but it's easier, and my instructions will assume they're using the same database with just different prefixes for the two (or more) installations of SMF. It does not matter what domain they are hosted on as long as they use the same MySQL server.

This will share user logins and PMs.

Assume you have two installations. One is an already established forum installation, and it uses the prefix "forumA_". The other is a new forum that you want to share forumA's logins and PMs. It has the prefix "forumB_". They're both in the database called "smf".

Log onto MySQL. There are a variety of tools for this but I just use commandline.
Now, once in MySQL, issue the following.
USE smf;

First, just move forumB's tables you want shared out of the way.
ALTER TABLE forumB_members RENAME TO forumB_members_old;
ALTER TABLE forumB_personal_messages RENAME TO forumB_personal_messages_old;
ALTER TABLE forumB_pm_recipients RENAME TO forumB_pm_recipients_old;


WARNING: Your forumA install will NOT be accessible once you do the following step until all steps are complete. It'd be wise to make a backup first too.
Next, rename forumA's tables to use a "shared_" prefix.
ALTER TABLE forumA_members RENAME TO shared_members;
ALTER TABLE forumA_personal_messages RENAME TO shared_personal_messages;
ALTER TABLE forumA_pm_recipients RENAME TO shared_pm_recipients;


Finally, create views of the shared tables for both forumA and forumB so they see the exact same tables and the info is the same for both.
First, forumA:
CREATE VIEW forumA_members AS SELECT * FROM shared_members;
CREATE VIEW forumA_personal_messages AS SELECT * FROM personal_messages;
CREATE VIEW forumA_pm_recipients AS SELECT * FROM shared_pm_recipients;


And next, forumB:
CREATE VIEW forumB_members AS SELECT * FROM shared_members;
CREATE VIEW forumB_personal_messages AS SELECT * FROM personal_messages;
CREATE VIEW forumB_pm_recipients AS SELECT * FROM shared_pm_recipients;


Presto! Finished! Both forumA and forumB share users and PMs!

If anybody can spot corrections or something wrong with the above instructions, let me know and I'll correct it.
This is nice if the data is fixed i.e. with no new data coming in. If not, you will have to keep copying all the time, right? Or am I getting it all wrong?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 05, 2010, 07:15:54 AM
No, creating VIEWs allows MySQL to silently deal with it and SMF won't notice or care.

Note that member avatars are shared if they use an external URL or pick from the gallery (since that's stored in the members table, along with their post count) but not if they upload their own (since that's stored in the attachments table)
Title: Re: Share user database for 2 (or more) different forums.
Post by: mkmeister on March 05, 2010, 09:25:12 AM
Quote from: GrassrootsPA on March 04, 2010, 09:27:44 PM
mkmeister,

Three 'dumb' questions from a SMF newbie:  ;)

1) Are you using phpMyAdmin for the MYSQL edits?

2) One can do this sharing for 3 or more databases as well (not just two), right?

3) Would it be possible for someone to create a mod that does this sharing? (I personally am uncomfortable messing around with MYSQL tables and would prefer a mod, if possible)

1. Nope, just commandline (in Linux), but phpMyAdmin would work just fine.

2. Yes, you can do it for as many installs of SMF that you want.

3. I suppose so? When I get some free time I'll certainly look into it.
Title: Re: Share user database for 2 (or more) different forums.
Post by: mkmeister on March 05, 2010, 10:19:40 AM
Quote from: Arantor on March 05, 2010, 07:15:54 AM
No, creating VIEWs allows MySQL to silently deal with it and SMF won't notice or care.

Note that member avatars are shared if they use an external URL or pick from the gallery (since that's stored in the members table, along with their post count) but not if they upload their own (since that's stored in the attachments table)

Agreed, the only time you'd have to recreate the view is if the table structure changed in some way, but I'm guessing that doesn't happen too often.

Arantor makes a good point about some possibly quirky behavior. The way to solve that of course would be to get more complex with the views. Could probably accomplish only sharing certain data between the two installations by creating yet another table to store the non-shared data and getting selective with your query for the view.

For example, if you didn't want to share your PMs across and wanted your post count to be relevant to the forum you're on, I guess you could skip the part where the PM tables are shared, create a new table called something like "forumA_members_counts", and create fields for the ID_MEMBER, posts, instantMessages, and unreadMessages, remove those fields completely from the shared_members table, and then in your view you could do something like this:
CREATE VIEW forumA_members AS SELECT * FROM shared_members LEFT JOIN forumA_members_counts ON forumA_members_counts.ID_MEMBER = shared_members.ID_MEMBER;

I would think that'd be the most useful and polished method of sharing only certain data relevant to each forum.

Thoughts, Arantor?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 05, 2010, 10:25:33 AM
You'd also possibly have to split off the avatar column too, as that's where URL/gallery avatar is stored. Theory sounds good; and it's exactly what views are designed for, abstracting the physical structure away below the application level.

Not sure I'd LEFT JOIN, though, since I'd argue those are mandatory fields, so I'd probably INNER JOIN instead but that's not really a huge thing.

Oh... and membergroups. Membergroups are stored in the row too: ID_GROUP, ID_POST_GROUP, additionalGroups. If the rules are exactly the same on both forums and permissions too (down to the physical group ids) it's fine. If there's any difference, you're likely to want to split them out as well into the individual forum tables.

(People look at me funny when I tell them it's a huge amount of work. It's because everything is so tightly wrapped it's not funny.)
Title: Re: Share user database for 2 (or more) different forums.
Post by: GrassrootsPA on March 05, 2010, 01:38:20 PM
mkmeister, glad to hear you will look into making a mod around this.

Very excited to hear this! Thanks for all you do.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on March 06, 2010, 07:37:52 AM
Quote from: Arantor on March 05, 2010, 07:15:54 AM
No, creating VIEWs allows MySQL to silently deal with it and SMF won't notice or care.

Note that member avatars are shared if they use an external URL or pick from the gallery (since that's stored in the members table, along with their post count) but not if they upload their own (since that's stored in the attachments table)
Aah! Clever...
Title: Re: Share user database for 2 (or more) different forums.
Post by: mkmeister on March 07, 2010, 02:12:01 AM
Quote from: Arantor on March 05, 2010, 10:25:33 AM
(People look at me funny when I tell them it's a huge amount of work. It's because everything is so tightly wrapped it's not funny.)

Haha, yeah, I'm gettin' that feeling. I'm not so sure it'd be as much of a mod as a one-off script, but even then it'd pretty much force the person doing it to make the choice once and stick with it as far as what exactly they want shared, because of all the potential data moving around and tables creation/dropping if someone would decide to change their mind. I guess I don't feel it's a mod's job to potentially constantly be dropping and adding tables, fields, views, etc.

Even then... migrating from a few forums that already exist could be... is "itchy" the right word for it? That doesn't even consider that there might possibly be a mod out there that actually adds a field to a table that I'd be replacing with a view... which means it would break that mod if the mod was installed after the view is already created, since a view only captures the fields that exist at the time it was created. I don't know if any mods actually alter core table structures or anything, but it's a possibility to consider.
Title: Re: Share user database for 2 (or more) different forums.
Post by: GrassrootsPA on March 07, 2010, 02:24:16 AM
What about some sort of mod that all forums that want to share the data would need to install and turn on? (like a key?)

How about the creation of a "dummy" mysql table all the installs sync data with?

Trying to think outside the box here (really want this feature)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 07, 2010, 08:38:22 AM
Mods do modify core tables, they're perfectly allowed to provided they don't break anything.

The one thing I would say to you is that this requires MySQL 5 and that you run the risk of trying to support people who still use MySQL 4 (yes, some people still do, just as some people still run PHP 4.3.x)
Title: Re: Share user database for 2 (or more) different forums.
Post by: mkmeister on March 08, 2010, 10:04:07 AM
Quote from: Arantor on March 07, 2010, 08:38:22 AM
Mods do modify core tables, they're perfectly allowed to provided they don't break anything.

The one thing I would say to you is that this requires MySQL 5 and that you run the risk of trying to support people who still use MySQL 4 (yes, some people still do, just as some people still run PHP 4.3.x)

Good point about MySQL 4, but if it did views, I'd just simply required 5. In any case, since mods do modify core tables, a mod that creates views like this is completely out of the question.

It'd have to be a code patch to be a mod.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 08, 2010, 10:05:48 AM
Most mods modify code too, but that's why I cannot recommend this being a mod because the core tables do often get changed. (I've done it more than once)

Though, I don't modify any core table in SimpleDesk; I just add new tables.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on March 09, 2010, 07:04:19 AM
Would it work the same with SMF 2.0 RC2 and later? I mean if this really involves MySQL only, it should work right?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 09, 2010, 10:12:29 AM
Yup, that's the idea but do see the caveats from me above, like about membergroups and so on.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on March 10, 2010, 05:37:50 AM
Quote from: Arantor on March 09, 2010, 10:12:29 AM
Yup, that's the idea but do see the caveats from me above, like about membergroups and so on.
Great. Can somebody make this for SMF 2.0 RC?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 10, 2010, 06:32:08 AM
Right, so did you read my comments about membergroups?

Are you having the exact same membergroups in all forums and giving users the same permissions in all forums or what?


Oh, and which RC, there's been 5... (RC1, RC1-1, RC1.2, RC2, RC3)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on March 12, 2010, 10:25:11 AM
Quote from: Arantor on March 10, 2010, 06:32:08 AM
Right, so did you read my comments about membergroups?

Are you having the exact same membergroups in all forums and giving users the same permissions in all forums or what?


Oh, and which RC, there's been 5... (RC1, RC1-1, RC1.2, RC2, RC3)
I did. I was just hoping to see somebody do it on 2.0 RC (now is 3) and see how wonderful it works.

However, playing with database like this is not advisable for me myself or others like me (newbies). I prefer a safer mod like Multiple Forum Mod or even Shared Forum Mod. It is just not worth a try and end up ruining a good running forum. Unless, you are merely just trying.

I say it is a hard work but worth it for for web programmers and developers. I will have to say no to mod like this and avoid this.

If I even try doing, I will try the first page suggestion. It seems safer to me.
Title: Re: Share user database for 2 (or more) different forums.
Post by: gitchuone on March 12, 2010, 11:41:21 PM
Quote from: mkmeister on March 04, 2010, 03:35:19 PM
OK, here's a step by step of exactly what I did. There were ZERO code changes, and only used MySQL to pull it off as noted in a previous post.

As a note, I'm using SMF 1.1.11 and MySQL 5.0.x. If SMF 2.x uses a similar table structure (haven't looked at it personally yet), I'd imagine it'd work just as well and still no code changes. They don't even need to be on the same database, but it's easier, and my instructions will assume they're using the same database with just different prefixes for the two (or more) installations of SMF. It does not matter what domain they are hosted on as long as they use the same MySQL server.

This will share user logins and PMs.

Assume you have two installations. One is an already established forum installation, and it uses the prefix "forumA_". The other is a new forum that you want to share forumA's logins and PMs. It has the prefix "forumB_". They're both in the database called "smf".

Log onto MySQL. There are a variety of tools for this but I just use commandline.
Now, once in MySQL, issue the following.
USE smf;

First, just move forumB's tables you want shared out of the way.
ALTER TABLE forumB_members RENAME TO forumB_members_old;
ALTER TABLE forumB_personal_messages RENAME TO forumB_personal_messages_old;
ALTER TABLE forumB_pm_recipients RENAME TO forumB_pm_recipients_old;


WARNING: Your forumA install will NOT be accessible once you do the following step until all steps are complete. It'd be wise to make a backup first too.
Next, rename forumA's tables to use a "shared_" prefix.
ALTER TABLE forumA_members RENAME TO shared_members;
ALTER TABLE forumA_personal_messages RENAME TO shared_personal_messages;
ALTER TABLE forumA_pm_recipients RENAME TO shared_pm_recipients;


Finally, create views of the shared tables for both forumA and forumB so they see the exact same tables and the info is the same for both.
First, forumA:
CREATE VIEW forumA_members AS SELECT * FROM shared_members;
CREATE VIEW forumA_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW forumA_pm_recipients AS SELECT * FROM shared_pm_recipients;


And next, forumB:
CREATE VIEW forumB_members AS SELECT * FROM shared_members;
CREATE VIEW forumB_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW forumB_pm_recipients AS SELECT * FROM shared_pm_recipients;


Presto! Finished! Both forumA and forumB share users and PMs!

If anybody can spot corrections or something wrong with the above instructions, let me know and I'll correct it.

EDIT: Corrected a couple of typos.

So far this has worked great for me on 2.0 RC2.

I also shared the membergoups.

testing continues.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Rawn on March 14, 2010, 08:54:58 PM
I'm also doing this, I've shared everything across 5 installs (multi-MMO community). I'm going back now and redoing it, trying to separate out:

ID_GROUP
realName
personalText
signature
avatar
usertitle
additionalGroups
ID_POST_GROUP

I'll post how it goes =)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 14, 2010, 09:08:17 PM
Just a few comments:
avatar column relates to avatar-by-URL or from gallery, not normally to uploaded avatars (which is the attachments table)

Matching up the groups is fine - provided you do something with the membergroups table too, because there will be overlaps, and you will basically have to share that table because otherwise you're going to have overwrites and permission drops when groups change for a user.
Title: Re: Share user database for 2 (or more) different forums.
Post by: CairX on March 22, 2010, 06:47:38 PM
Quote from: Rawn on March 14, 2010, 08:54:58 PM
I'm also doing this, I've shared everything across 5 installs (multi-MMO community). I'm going back now and redoing it, trying to separate out:

ID_GROUP
realName
personalText
signature
avatar
usertitle
additionalGroups
ID_POST_GROUP

I'll post how it goes =)

I'm also looking for some way to filter out rows from a table.
However I'm not very familiar with MySQL, but when you create a VIEW you can't add more variables/rows.
Maybe someone could fill me in with info about that?

If you can't do it that way, is there a "simple" way to do it in some files without making to much change?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 22, 2010, 07:45:18 PM
QuoteIf you can't do it that way, is there a "simple" way to do it in some files without making to much change?

Short answer is no. SMF's schema is just not designed for this.
Title: Re: Share user database for 2 (or more) different forums.
Post by: CairX on March 23, 2010, 06:07:57 PM
Quote from: Arantor on March 22, 2010, 07:45:18 PM
QuoteIf you can't do it that way, is there a "simple" way to do it in some files without making to much change?

Short answer is no. SMF's schema is just not designed for this.
Not a happy answer but yet an answer, Thank you  :)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 23, 2010, 06:09:41 PM
This thread does discuss multiple ways of doing it, but all require significant change or come with significant caveats and gotchas. There's no simple way that actually works cleanly without any side effects :(
Title: Re: Share user database for 2 (or more) different forums.
Post by: mkmeister on March 24, 2010, 09:37:43 AM
Quote from: Arantor on March 23, 2010, 06:09:41 PM
This thread does discuss multiple ways of doing it, but all require significant change or come with significant caveats and gotchas. There's no simple way that actually works cleanly without any side effects :(

Also, it might be difficult to pull off and still make everyone happy. It's fairly obvious from this thread there are many different things people want in this kind of system and they all don't necessarily agree.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 24, 2010, 10:45:50 AM
The only way to do it to make everyone actually happy is to redesign the schema from scratch specifically to allow for it.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on March 24, 2010, 04:10:51 PM
Quote from: Arantor on March 24, 2010, 10:45:50 AM
The only way to do it to make everyone actually happy is to redesign the schema from scratch specifically to allow for it.
Oh... That is hardwork. By the way, will they do that?
Title: Re: Share user database for 2 (or more) different forums.
Post by: mkmeister on March 24, 2010, 04:16:15 PM
I imagine that would break a LOT of mods if the schema was completely redesigned like that, considering v2 is right on the doorstep.

I could see a version 3 though... hmmm...
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 24, 2010, 04:36:06 PM
Won't happen in 2.0 AT ALL. Hence the term feature locked as is made quite clear in the Feature Requests board.

I see possibly minor changes to it in 2.1 but an overhaul generally in 3.0. I don't see it being capable of this out of the box though.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Mr. Doug on March 27, 2010, 09:05:41 AM
I've got 4 sites that I want to share a user database for. All are on the same server, so that part isn't hard. I'm wondering if it wouldn't be easier to start an OpenID server that I host locally to accomplish the same thing.

Am I close here, or should I be looking at a different implementation?

(I also need to convert about 25,000 members from PHPbb3, but that's a whole different story.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Mr. Doug on March 27, 2010, 04:36:02 PM
I tried this today, and the result is that forumA still works fine, but forumB does not. I'm thinking that this has something to do with a fresh install, vs. an upgrade from 1.1.X (I'm using RC3 in both)

Thoughts?

ForumA works fine in every way. Forum B won't show anything other than "Please try again. If you come back to this error screen, report the error to an administrator."
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on March 27, 2010, 05:17:40 PM
Though, I am very afraid to try this "MySQL things" at first glance, I actually did try this on SMF 2.0 RC3 when i read it is noted as being successful. It really works. I also shared membergroups.

I later noticed that problem with avatar and attachments can be resolved IMHO if we point avatar URL & PATH to one main site for keeping avatar & attachment files. At the same time, share the avatar / attachment table using this tips.

I didnt try this yet but is this possible Arantor?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Mr. Doug on March 27, 2010, 05:30:05 PM
Update: I'm a dumb-a$$

I was working with a backup that was named the same. So of COURSE the update worked for one and not the other...the DB was from the 1.1 structure, and not 2.0. (It was also about 2 years old) I noticed that the forum only had 1,800 members. We have about 11,000 now...so I was all bent that it was messing things up there too.

OK...I'll try this again in a bit and report the results.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 27, 2010, 05:47:31 PM
QuoteAt the same time, share the avatar / attachment table using this tips.

Incredibly bad idea!

Assuming you have two topic and two message tables, you'll be duplicating attachments unless you modify all the attachment handling code too (have fun with that)

Basically, an attachment is attached to a post by id. If you attach a file to message id 1000, the same attachment is visible in BOTH sides' message 1000.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on March 27, 2010, 06:20:14 PM
Quote from: Arantor on March 27, 2010, 05:47:31 PM
Incredibly bad idea!

Assuming you have two topic and two message tables, you'll be duplicating attachments unless you modify all the attachment handling code too (have fun with that)

Basically, an attachment is attached to a post by id. If you attach a file to message id 1000, the same attachment is visible in BOTH sides' message 1000.
Wow... ok.
Quote from: Arantor on March 05, 2010, 07:15:54 AM
Note that member avatars are shared if they use an external URL or pick from the gallery (since that's stored in the members table, along with their post count) but not if they upload their own (since that's stored in the attachments table)
So we just leave the last part for the time being and do not allow members to upload but they can instead use an external URL or pick from the gallery? Will that be fine Arantor?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 27, 2010, 06:32:27 PM
Yeah, that works.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on March 27, 2010, 06:39:58 PM
Thanks a lot for your patience, tips and supports.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Mr. Doug on March 27, 2010, 08:22:14 PM
Ok...so that was the most painless process on the planet. (after I got everything in the same DB)

RC3, up and running with no issues using the MySQL method. The only thing I'd add is that you need to make sure you "recount forum statistics" after you link them all to the same user DB. I'm showing the correct count across 3 sites now. (Soon to be 4...as soon as I can figure out how to import 25,000 phpBB3 users to my SMF installation.)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on March 28, 2010, 05:49:08 AM
Quote from: Mr. Doug on March 27, 2010, 08:22:14 PM
Ok...so that was the most painless process on the planet. (after I got everything in the same DB)

RC3, up and running with no issues using the MySQL method. The only thing I'd add is that you need to make sure you "recount forum statistics" after you link them all to the same user DB. I'm showing the correct count across 3 sites now. (Soon to be 4...as soon as I can figure out how to import 25,000 phpBB3 users to my SMF installation.)

By the way, do you face any problems with cookie(s)? It seems like I cannot login or logout or do certain admin settings properly. I bothers me when it says "You were unable to login. Please check your cookie settings." I have tried cleaning cookies, clear caches, setting new cookies' name, using repair_settings.php and even re-upgrade to RC3 with no success at all.

Any advices guys?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Mr. Doug on March 28, 2010, 08:26:56 AM
I've had no issues with cookies. Just make sure your cookies aren't named the same way. (keep them all different.)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on March 28, 2010, 10:54:59 AM
I guess my mod is creating this problem. Thanks anyway.
Title: Re: Share user database for 2 (or more) different forums.
Post by: forfun on March 29, 2010, 01:17:25 AM
If the second forum is located in a sub-domain and in a different database, but both databases are located in the same server, will it be able to "share" the same members/PM accounts.
Thanks much in advanced
Title: Re: Share user database for 2 (or more) different forums.
Post by: Mr. Doug on March 29, 2010, 08:38:17 AM
I found a caveat to a shared member DB. Make sure all the Themes on your boards are numbered the same way. If I make a change the default to one (and reset the members options), all 3 get the change pushed.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 29, 2010, 08:41:20 AM
Note also that custom profile fields are also in that table...
Title: Re: Share user database for 2 (or more) different forums.
Post by: Mr. Doug on March 30, 2010, 02:02:59 PM
Here's another thought...if I share the banlogs and ban-triggers, would that translate? I can't imagine it wouldn't, but thought I'd ask before I just went and shared them.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 30, 2010, 02:09:54 PM
That should be fine.
Title: Re: Share user database for 2 (or more) different forums.
Post by: j4r3k on March 31, 2010, 06:49:47 AM
Hello,
I have successfully merged more than 2 forums together (running SMF 1.1.11). Sharing tables:
members
membergroups
personal_messages
pm_recipients
log_online
smileys

My PROBLEM is when new user registers the info about totalusers and latest member does not update.
Someone posted a solution here (http://www.simplemachines.org/community/index.php?topic=271586.msg1829413#msg1829413) but it doesn't work.
Only the latestRealName field in _settings tables is updated, but the totalMembers does not update.

Any ideas how to fix it?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Mr. Doug on March 31, 2010, 08:36:06 AM
I ran into the same thing. If you run the "update statistics" maintenance, it fixes it. So now I just run that every few days until I can get around to writing a cron script that does it for me. Everything functions correctly, it just doesn't update the number of users in the bottom of the page..
Title: Re: Share user database for 2 (or more) different forums.
Post by: j4r3k on March 31, 2010, 09:08:27 AM
There must be a way to solve this.
From my investigation it works this way:
even if you manually update all the _settings tables (fields: latestMember, totalMembers) the info won't show at the bottom of main page, action that updates stats must take place - user registers for example - but then this action does not update _settings tables regardless of the code I included above, so your are 1 user behind already  :(
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 31, 2010, 10:20:39 AM
Did you also:
* update $modSettings in memory?
* force the cache to be emptied?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 31, 2010, 11:04:01 AM
So what are you actually feeding $value as then?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 31, 2010, 11:26:24 AM
How are you calling it exactly?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 31, 2010, 11:44:24 AM
updateSettings(array('totalMembers' => true), true);

This is what I was looking for. Is that the line you're using?

See I don't understand how you've mashed up the code, to be quite blunt.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on March 31, 2010, 12:15:22 PM
See, that's the thing. You've thrown so much in the posts, out of context, that it's very hard to actually follow.

I actually thought you needed updateStats(array('totalMembers' => '+')); first of all.
Title: Re: Share user database for 2 (or more) different forums.
Post by: j4r3k on March 31, 2010, 12:30:38 PM
Sorry for the mess.
I updated my first post, is it clear now what I'm trying to achieve?
Deleted my other posts.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Mr. Doug on March 31, 2010, 02:33:48 PM
Quote from: j4r3k on March 31, 2010, 12:30:38 PM
Sorry for the mess.
I updated my first post, is it clear now what I'm trying to achieve?
Deleted my other posts.

That actually confuses things more sometimes...
Title: Re: Share user database for 2 (or more) different forums.
Post by: j4r3k on April 01, 2010, 06:11:13 AM
OK, here is a solution that updates all your forums total members count right away after new user registration (there is no need to use 'update statistics' from admin panel). For SMF 1.1.11.

First of all we'll make it work using the 'update statistics' option too. In Subs.php

Find

updateSettings($changes);


Replace with

//updateSettings($changes);
foreach ($changes as $variable => $value)
{
db_query("
UPDATE prefix1_settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);

db_query("
UPDATE prefix2_settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);

$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));
}


add more prefixes according to your needs.

Second step: make it work after user registration. In Subs.php

Find

if ($update)
{
foreach ($changeArray as $variable => $value)
{
db_query("
UPDATE {$db_prefix}settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);


Replace with

if ($update)
{
foreach ($changeArray as $variable => $value)
{
db_query("
UPDATE {$db_prefix}settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);

if ($variable == 'totalMembers')
{
db_query("
UPDATE prefix1_settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);

db_query("
UPDATE prefix2_settings
SET value = " . ($value === true ? 'value + 1' : ($value === false ? 'value - 1' : "'$value'")) . "
WHERE variable = '$variable'
LIMIT 1", __FILE__, __LINE__);
}
$modSettings[$variable] = $value === true ? $modSettings[$variable] + 1 : ($value === false ? $modSettings[$variable] - 1 : stripslashes($value));



Note that in this step you must enter only the prefixes that are in other forums than you are currently editing. For example if your are editing Subs.php in forum with prefix1 then you enter prefix2, prefix3 into the if statement. prefix1 is handled by {$db_prefix}.

Remember to edit all Subs.php in each forum so the 'update statistics' and user registration works on each forum same way.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Liam. on April 10, 2010, 04:40:34 PM
Great bit there j4r3k, I'm soon to try that on my 1.1.11 test forums - have you tried if this works on 2.0 RC3 aswell though?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on April 10, 2010, 06:45:10 PM
Quote from: iKorp on April 10, 2010, 04:40:34 PM
Great bit there j4r3k, I'm soon to try that on my 1.1.11 test forums - have you tried if this works on 2.0 RC3 aswell though?
It's a littble bit complicated with 2.0 RC3 files. It is no longer just Subs.php file. You may have to go through other files as well. I normally use UltraEdit to check all files for the relevant code. By the VIEW tips & tricks in MySQL / phpAdmin works. That is all I can say.
Title: Re: Share user database for 2 (or more) different forums.
Post by: j4r3k on April 11, 2010, 06:51:36 AM
Quote from: Liam. on April 10, 2010, 04:40:34 PM
have you tried if this works on 2.0 RC3 aswell though?

No, I didn't.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Liam. on April 11, 2010, 07:14:10 AM
I have a mass search/replace program I could use... But would that be the only thing, changing it in all of the files instead of just Subs?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on April 19, 2010, 06:59:07 PM
Quote from: Liam. on April 11, 2010, 07:14:10 AM
I have a mass search/replace program I could use... But would that be the only thing, changing it in all of the files instead of just Subs?
Yes all the files in sources folder.
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on June 05, 2010, 10:34:12 PM
I'm using RC3, and I'm not entirely sure I'm searching for the correct thing, as I can't seem to find that which I need to replace...

Quote2. Modifying the source code
Open each of the .php files located in the Sources directory in your hard drive using a text editor program. Find all occurances of "{$db_prefix}members" and replace with "smf1_members" (without quotes). Do this for every single .php file in the Sources directory. Also find and replace the following:
"{$db_prefix}im_recipients" => "smf1_im_recipients"
"{$db_prefix}instant_messages" => "smf1_instant_messages"
"{$db_prefix}membergroups" => "smf1_membergroups"

am I looking for:
{$db_prefix}instant_messages
{$rpg2_}instant_messages
$rpg2_instant_messages
rpg2_instant_messages

... or what? Sorry, but I'm completely lost! >.< and nothing seems to be throwing up a result.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on June 06, 2010, 08:12:00 AM
You are looking for this:
Quote from: FireDitto on June 05, 2010, 10:34:12 PM
$db_prefix
with a note that it may not be in (or only in) the form of {$db_prefix}. Backup before you make any changes. Do read all the questions and guides in here, if any, especially regarding the caveat in doing this. Good luck in getting any help as this mod is way back to 2004 and there are many changes in SMF especially now it is 2.0 RC3 when then it was in very early 1.1.x.

IMHO,you might prefer this (http://www.simplemachines.org/community/index.php?topic=16190.msg2523327#msg2523327) with some caveat as well.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on June 11, 2010, 05:34:54 PM
You are welcome. Hope we all will always try to learn and share earned knowledge to each other.
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on June 13, 2010, 04:57:30 AM
Ugh. I got an error.

I followed the instructions here (http://www.simplemachines.org/community/index.php?topic=16190.msg2523327#msg2523327) with the added:

prefix_membergroups to shared_membergroups

And am now getting the following error on both sites:

"Connection Problems

Sorry, SMF was unable to connect to the database. This may be caused by the server being busy. Please try again later."


Did I screw up something in changing the membergroups, or elsewhere? I can't seem to find where I messed up.

Thanks.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on June 13, 2010, 10:11:45 AM
Have you completed all the steps correctly? Because my forums also stop working until I have finished all the steps correctly. Remember, always to backup your database in full before doing this and restore it back if anything goes on.

Check this list:
1. Ensure using USE smf correctly i.e. change smf to your database name.
2. Ensure using ALTER TABLE correctly.
3. Ensure CREATE VIEW correctly as well.
4. Lastly, DO NOT keep original table in the same original name.

IMHO your forums seems not connecting to database may be due to any of the above. Solutions? Restore your database and do it again.
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on June 13, 2010, 09:33:42 PM
I'm not *positive* where I messed up, but I re-did it very carefully and it's working beautifully now.

Thanks =)
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on June 14, 2010, 02:36:30 AM
Um, I'm having another issue now:

Although all the mods are installing correctly and without error, none of them are actually working... I thought it was a one off, and posted on the support thread, but after installing more with the same kind of results, I believe it's probably my editing of this that's cause the issue... somewhere.

Why would this be, and how do I correct it?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on June 14, 2010, 12:44:05 PM
Mods error might be due to the caveat as mentioned and discussed in this thread. If you can list the mods, maybe we will know where the fault came from.

Else, you have edited the sources file using the original mod which you shouldn't if you are using the database approach. If you did this, that may be the cause of your problem(s) and not the mod(s) (except if the mod is related to profile avatar like what Arantor had advised, although it is very unlikely in your case).
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on June 15, 2010, 12:47:04 AM
My mods are as follows; this is more or less a complete list of the mods I'll be employing:

Not working

EzPortal - perfect install, but member changes are not being saved [eg, who can view what].
Sub Accounts - Installed perfectly, but comes up with "Unknown column 'mem.is_shareable' in 'field list'" when I activated it in the Administration panel, and it's now all I get on that forum... I expect that would just be a few edits to make it working?

Working:
Add IP2Location to track IP.
Effectivly Remove SMF Logo.
Display Name on Registration.
Member Color Link.
Team Page.
Justify BBC.
Custom Forms.

Waiting for Update
Multiple Forums Mod



Thanks for any help =)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Masterd on June 15, 2010, 07:27:56 AM
Nice trick. I just needed that.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on June 15, 2010, 09:23:04 AM
Quote from: FireDitto on June 15, 2010, 12:47:04 AM
Not working

EzPortal - perfect install, but member changes are not being saved [eg, who can view what].
Sub Accounts - Installed perfectly, but comes up with "Unknown column 'mem.is_shareable' in 'field list'" when I activated it in the Administration panel, and it's now all I get on that forum... I expect that would just be a few edits to make it working?
I think Sub Account Mod as well as ezPortal do modify / add database. Maybe you want to share their tables too?

I listed the note on the Caveat & Gotchas of this database mod:
Quote from: Arantor on March 23, 2010, 06:09:41 PM
This thread does discuss multiple ways of doing it, but all require significant change or come with significant caveats and gotchas. There's no simple way that actually works cleanly without any side effects :(
Avatar Caveat:
Quote from: Arantor on March 05, 2010, 07:15:54 AM
Note that member avatars are shared if they use an external URL or pick from the gallery (since that's stored in the members table, along with their post count) but not if they upload their own (since that's stored in the attachments table)
Membergroup Caveat:
Quote from: Arantor on March 09, 2010, 10:12:29 AM
Yup, that's the idea but do see the caveats from me above, like about membergroups and so on.
Attachment Caveat:
Quote from: Arantor on March 27, 2010, 05:47:31 PM
Assuming you have two topic and two message tables, you'll be duplicating attachments unless you modify all the attachment handling code too (have fun with that)

Basically, an attachment is attached to a post by id. If you attach a file to message id 1000, the same attachment is visible in BOTH sides' message 1000.
Cookie Caveat:
Quote from: Mr. Doug on March 28, 2010, 08:26:56 AM
I've had no issues with cookies. Just make sure your cookies aren't named the same way. (keep them all different.)
Theme & Board Caveat:
Quote from: Mr. Doug on March 29, 2010, 08:38:17 AM
I found a caveat to a shared member DB. Make sure all the Themes on your boards are numbered the same way. If I make a change the default to one (and reset the members options), all 3 get the change pushed.
Custom Profile Caveat:
Quote from: Arantor on March 29, 2010, 08:41:20 AM
Note also that custom profile fields are also in that table...
Statistic Caveat:
Quote from: Mr. Doug on March 31, 2010, 08:36:06 AM
I ran into the same thing. If you run the "update statistics" maintenance, it fixes it. So now I just run that every few days until I can get around to writing a cron script that does it for me. Everything functions correctly, it just doesn't update the number of users in the bottom of the page..
Hope this will help. Happy testing! ;)
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on June 16, 2010, 02:48:36 AM
I shared the EzPortal and Sub Account databases, but I'm still getting the
"Unknown column 'mem.is_shareable' in 'field list'" error and none of my EzPortal things are saving still...

Playing around with it now to see if I can't fix the issue, but I'm honestly not sure what is up. =/
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on June 16, 2010, 05:42:44 AM
Quote from: FireDitto on June 16, 2010, 02:48:36 AM
I shared the EzPortal and Sub Account databases, but I'm still getting the
"Unknown column 'mem.is_shareable' in 'field list'" error and none of my EzPortal things are saving still...

Playing around with it now to see if I can't fix the issue, but I'm honestly not sure what is up. =/
1. Have you check your cookie settings for each forum? Is it the same or different? As suggested, it should be different.
2. Is 'mem.is_shareable' table shared too? If it is, then may be you wanna check the list whether it is the same with the other forum i.e. they are numbered the same way. Or you might want to disable any function related to that table (I dont use this mod but it may be related to the sharing of sub-account profile which might be related to its ID numbering).

Suggestions:
1. Try two fresh new forums with the same mods. See if the problems are the same.
2. Try other portal? (I like simpleportal)
3. Try without sub-account mod but with other portal? (IMHO you can always ask the portal or other mod author for help. ;))
4. Try wihout sub-account an portal mod? (May be you dont really need the sub account and portal and need something like ultimate profile and cms management mod?)

You might want to learn more about CREATE VIEW function (or limitation). Try to read this and google for more...
Limitation - http://www.java2s.com/Tutorial/MySQL/0180__View/Afewthingsarentallowedinaquerythatdefinesaview.htm
MySQL Manual - http://dev.mysql.com/doc/refman/5.0/en/create-view.html

Play around some more and see. You may finally find a good working combination. Good luck!

NB: Install mods only when it is useful in mods combination (with less headache unless I really want to) is my main preference. By the way, I like headache in learning as it makes me understand more (or stucked!) ;)
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on June 16, 2010, 05:50:45 AM
Quote from: Abu Fahim Ismail on June 16, 2010, 05:42:44 AM
Quote from: FireDitto on June 16, 2010, 02:48:36 AM
I shared the EzPortal and Sub Account databases, but I'm still getting the
"Unknown column 'mem.is_shareable' in 'field list'" error and none of my EzPortal things are saving still...

Playing around with it now to see if I can't fix the issue, but I'm honestly not sure what is up. =/

Unfortunately at the moment, my host is having issues so my forums are down. I'm answering these off memory, but I believe it to be right:

Quote1. Have you check your cookie settings for each forum? Is it the same or different? As suggested, it should be different.
99.9% sure they are different. I haven't touched them, so I don't see why they would be the same.

Quote2. Is 'mem.is_shareable' table shared too? If it is, then may be you wanna check the list whether it is the same with the other forum i.e. they are numbered the same way. Or you might want to disable any function related to that table (I dont use this mod but it may be related to the sharing of sub-account profile which might be related to its ID numbering).
I have NO idea what mem.is_shareable is or where to find it. I was hoping someone here would. I've looked, but I cannot find.

QuoteSuggestions:
1. Try two fresh new forums with the same mods. See if the problems are the same.
Hrm, will give it a shot when the forums are up again.

Quote2. Try other portal? (I like simpleportal)
*grimace* I'm not at all keen on the other portals. I like EzPortal far more than any of the others.

Quote3. Try without sub-account mod but with other portal? May be you dont really need the sub account and need something like ultimate profile mod? (Install mod only when it is useful in your combination (with less headache) is my main preference. ;))
No can do. I can't substitute the Sub Account mod for anything else; I need it for the functioning of the website.

QuoteYou might want to learn more about CREATE VIEW function (or limitation). Try to read this and google for more...
Limitation - http://www.java2s.com/Tutorial/MySQL/0180__View/Afewthingsarentallowedinaquerythatdefinesaview.htm
MySQL Manual - http://dev.mysql.com/doc/refman/5.0/en/create-view.html

Play around some more and see. You may finally find a good working combination. Good luck!
I'll have a look.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on June 16, 2010, 07:01:45 AM
Quote from: FireDitto on June 16, 2010, 05:50:45 AM
I have NO idea what mem.is_shareable is or where to find it. I was hoping someone here would. I've looked, but I cannot find.
Your database prefix=is_ and you are looking for table=shareable?
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on June 16, 2010, 07:19:32 AM
My prefixes are

main1_ , bod1_ and shared_

There isn't an is_ prefix.
Title: Re: Share user database for 2 (or more) different forums.
Post by: hachik0 on June 16, 2010, 08:22:13 AM
looks like the impossible just happened! thank you for sharing your idea. very enlightening to say the least! :D
Title: Re: Share user database for 2 (or more) different forums.
Post by: PurpleCrow on June 16, 2010, 10:24:51 AM
I have a quick question, just as a heads up I'm using SMF 2.0 RC3.

What I would like is to have two forums to have the same memberbase and membergroups. Would it be possible to have it set up to that one membergroup can see forums on one forum that regular members cant see, but be able to request to join that membergroup from the other forum?

IE: Member X wants to see forums on Forum B, could they request to be part of that membergroup via Forum A and be able to see those forums on Forum B?

I have no idea if that makes sense mind you...
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on June 16, 2010, 02:52:25 PM
That is just the membergroups and board settings. You can setup your board so that only certain membergroups be able to see it and others don't.
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on July 09, 2010, 09:43:02 AM
The issues I had earlier were destroyed by fully installing the different forums I wanted to use, putting all the mods on them that I wanted to use, and then going into the database and linking them all.

I may simply have miss-edited something previously, but I feel this is a clean way of doing it.

I have the following mods installed:

1.   EzPortal    0.4.0
2.   SubAccounts Mod    1.0.0
3.   Member Color Link    3.0.8
4.   Team Page    3.5.5
5.   Add IP2Location to Track IP    1.3
6.   Display Name On Registration    2.0
7.   Justify BBCode    2.3.1
8.   Custom Form Mod    1.6
9.   View / Enter Board Permissions    1.1  [not installed yet]
10.   MultiForum Mod    1.1

I run RC3

=D


Everything is working beautifully that I have thus far determined.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on July 15, 2010, 09:48:12 AM
Congratulation!
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on July 20, 2010, 04:39:22 AM
EzPortal is very fussy about the changes made to the database, and will only retain those instructions it was given before the databases are joined.

Any changes I've tried to make afterward, are completely ignored and do not register.

I have no idea how to correct this.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on July 20, 2010, 12:49:40 PM
Quote from: FireDitto on July 20, 2010, 04:39:22 AM
EzPortal is very fussy about the changes made to the database, and will only retain those instructions it was given before the databases are joined.

Any changes I've tried to make afterward, are completely ignored and do not register.

I have no idea how to correct this.
Have you try installing ezportal after the database is shared? You do not need to share ezportal IMHO. As far as i know most portal  can stand alone thus need not be sharing the same database with SMF (forum).
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on September 21, 2010, 06:20:31 AM
This has been further developed by Johncccccc but still haven't finish with its packaging yet.


There is also a subforums mod from PortaMX that will be out soon.
Quote from: ahrasis on September 21, 2010, 06:17:02 AM
I have forwarded the ideas to PortaMX and they have developed a very good mod for this and it is called a subforums mod. Those who are in need of this mod may request it from PortaMX (feline). They will release their beta soon an d it will also be packed together with PortaMX Portal mod.
Title: Re: Share user database for 2 (or more) different forums.
Post by: DVDRiper on October 23, 2010, 09:49:11 AM
Hi,

I have installed two smf forums. They are installed in two different databases, but with one user and forums have another table prefix (smf1_, smf2_).

I need tutorial how to share members on these two forums.

Thanks in advance!
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on October 23, 2010, 04:03:42 PM
The tutorial is in the first post. Some members also help in this topic but you'll need to go through all of the posts. Good luck!
Title: Re: Share user database for 2 (or more) different forums.
Post by: DVDRiper on October 23, 2010, 06:46:51 PM
I need someone from the staff who is willing to give me reflect this process. I need only users connected to two forums.

The following is a reward!

Interested should contact me on pm.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on October 24, 2010, 04:49:43 PM
Quote from: DVDRiper on October 23, 2010, 06:46:51 PM
I need someone from the staff who is willing to give me reflect this process. I need only users connected to two forums.

The following is a reward!

Interested should contact me on pm.
From the staff? You mean SMF Team members? In that case you can just wait for pm from any of them.
Title: Re: Share user database for 2 (or more) different forums.
Post by: semimedia on November 06, 2010, 11:51:40 AM
Hi,

I'm trying to share two forums at different domains but same host.

I'm sharing members perfectly, but I need share uploaded avatars too.

For this I seperated avatars from attachments table to a new table.

I think if we edit subs files for this (not all {db_prefix}attachments to avatars table, just only related with uploaded avatars), it must be working fine.
But I don't know which are related to uploaded avatars.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on November 06, 2010, 12:31:50 PM
Uploaded avatars is one of the caveat mentioned when using this idea/mod. The reason is the uploaded avatars are kept in different directory/forum and have different ID.
Title: Re: Share user database for 2 (or more) different forums.
Post by: semimedia on November 06, 2010, 05:47:26 PM
My forums can use same directory for uploaded avatars and they seems like not using different id for causing any problems.

I achieved making uploaded avatars stored to new table easily, but I couldn't find how to read from this table.
Title: Re: Share user database for 2 (or more) different forums.
Post by: NanoSector on November 21, 2010, 08:56:02 AM
Any way on how to do this in 2.0 RC4?

I got jCreator and it doesn't find anything with {db_prefix}.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on November 21, 2010, 11:30:58 AM
There are two approaches in this thread. One that you are trying to use, and the other is via mySQL/phpMyAdmin. Try searching db_prefix or just prefix instead.
Title: Re: Share user database for 2 (or more) different forums.
Post by: NanoSector on November 21, 2010, 11:40:09 AM
Quote from: ahrasis on November 21, 2010, 11:30:58 AM
There are two approaches in this thread. One that you are trying to use, and the other is via mySQL/phpMyAdmin. Try searching db_prefix or just prefix instead.
Can you tell me what exact to search for? I'm not really sure if I get your comment the right way.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on November 21, 2010, 11:49:49 AM
It is under Sources folder (all files). If you are in doubt, ask Johncccccc. He had made a mod (half way) to do this and it works. I missed the mod files he gave me, so I guess, you'll need to ask him then, if you need that.
Title: Re: Share user database for 2 (or more) different forums.
Post by: C.Fultz on November 26, 2010, 05:04:41 PM
Quote from: mkmeister on March 04, 2010, 03:35:19 PM
OK, here's a step by step of exactly what I did. There were ZERO code changes, and only used MySQL to pull it off as noted in a previous post.

As a note, I'm using SMF 1.1.11 and MySQL 5.0.x. If SMF 2.x uses a similar table structure (haven't looked at it personally yet), I'd imagine it'd work just as well and still no code changes. They don't even need to be on the same database, but it's easier, and my instructions will assume they're using the same database with just different prefixes for the two (or more) installations of SMF. It does not matter what domain they are hosted on as long as they use the same MySQL server.

This will share user logins and PMs.

Assume you have two installations. One is an already established forum installation, and it uses the prefix "forumA_". The other is a new forum that you want to share forumA's logins and PMs. It has the prefix "forumB_". They're both in the database called "smf".

Log onto MySQL. There are a variety of tools for this but I just use commandline.
Now, once in MySQL, issue the following.
USE smf;

First, just move forumB's tables you want shared out of the way.
ALTER TABLE forumB_members RENAME TO forumB_members_old;
ALTER TABLE forumB_personal_messages RENAME TO forumB_personal_messages_old;
ALTER TABLE forumB_pm_recipients RENAME TO forumB_pm_recipients_old;


WARNING: Your forumA install will NOT be accessible once you do the following step until all steps are complete. It'd be wise to make a backup first too.
Next, rename forumA's tables to use a "shared_" prefix.
ALTER TABLE forumA_members RENAME TO shared_members;
ALTER TABLE forumA_personal_messages RENAME TO shared_personal_messages;
ALTER TABLE forumA_pm_recipients RENAME TO shared_pm_recipients;


Finally, create views of the shared tables for both forumA and forumB so they see the exact same tables and the info is the same for both.
First, forumA:
CREATE VIEW forumA_members AS SELECT * FROM shared_members;
CREATE VIEW forumA_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW forumA_pm_recipients AS SELECT * FROM shared_pm_recipients;


And next, forumB:
CREATE VIEW forumB_members AS SELECT * FROM shared_members;
CREATE VIEW forumB_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW forumB_pm_recipients AS SELECT * FROM shared_pm_recipients;


Presto! Finished! Both forumA and forumB share users and PMs!

If anybody can spot corrections or something wrong with the above instructions, let me know and I'll correct it.

EDIT: Corrected a couple of typos.

I wanna thank you soooo much! You are an awesome help!
Title: Re: Share user database for 2 (or more) different forums.
Post by: jekwumoore on December 19, 2010, 04:17:57 AM
I am gonna give this a try
Title: Re: Share user database for 2 (or more) different forums.
Post by: Another Rob on January 27, 2011, 06:46:10 PM
I'm running RC3, i just want to have a few sites using the same membership list, so member1 signs up on site1, then can login to site2 and site3 as well without having to sign up individually. should i have any problems using the MySQL method?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on January 31, 2011, 12:45:30 PM
Quote from: Another Rob on January 27, 2011, 06:46:10 PM
I'm running RC3, i just want to have a few sites using the same membership list, so member1 signs up on site1, then can login to site2 and site3 as well without having to sign up individually. should i have any problems using the MySQL method?
We won't know until you try it  ;D
Title: Re: Share user database for 2 (or more) different forums.
Post by: priceform on February 03, 2011, 01:02:38 PM
Hi

Just got the forum for my site. I previously had a forum using different software. Is there any way I can import the messages/users from that forum in to my new one.

Thanks ;D
Title: Re: Share user database for 2 (or more) different forums.
Post by: Illori on February 03, 2011, 01:05:59 PM
please open a separate topic for your issue. you may also want to check out the converters on the download page.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Quinn on February 17, 2011, 03:35:11 PM
Quote from: ahrasis on January 31, 2011, 12:45:30 PM
Quote from: Another Rob on January 27, 2011, 06:46:10 PM
I'm running RC3, i just want to have a few sites using the same membership list, so member1 signs up on site1, then can login to site2 and site3 as well without having to sign up individually. should i have any problems using the MySQL method?
We won't know until you try it  ;D

I have 1.1.13 and rc5 and it doesn't seem to work. Apparently there are several changes to the members tables from 1.1.xx to 2.0 that break using the MySQL view method. It should work for 2.0 RCx
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on February 17, 2011, 03:40:07 PM
Quote from: Quinn on February 17, 2011, 03:35:11 PM
Quote from: ahrasis on January 31, 2011, 12:45:30 PM
Quote from: Another Rob on January 27, 2011, 06:46:10 PM
I'm running RC3, i just want to have a few sites using the same membership list, so member1 signs up on site1, then can login to site2 and site3 as well without having to sign up individually. should i have any problems using the MySQL method?
We won't know until you try it  ;D

I have 1.1.3 and rc5 and it doesn't seem to work. Apparently there are several changes to the members tables from 1.1x to 2.0 that break using the mysql method. It should work for 2.0 RCx
IMO it won't work on different SMF version especially between 1.x and 2.x. But I do think it will work on the same version using mysql technique.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Quinn on February 17, 2011, 04:21:19 PM
Quote
IMO it won't work on different SMF version especially between 1.x and 2.x. But I do think it will work on the same version using mysql technique.

I have to agree... since I have already tested this on my site. I hope there is an import feature or upgrade in the works for 1.1.xx to 2.0 as I am sure there are a lot of 1.xx sites that would migrate to 2.0 Final
Title: Re: Share user database for 2 (or more) different forums.
Post by: Illori on February 18, 2011, 06:09:09 AM
there is an upgrade process from 1.1.1* to 2.0 already, upgrade.php.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Quinn on February 18, 2011, 11:31:51 AM
Quote from: Illori on February 18, 2011, 06:09:09 AM
there is an upgrade process from 1.1.1* to 2.0 already, upgrade.php.

Thank you, I'll look into it when 2.0 goes Gold. Right now I am working on the new theme template with rc5 while the 1.1.3 site is up and working fine.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Eudemon on February 21, 2011, 02:33:44 PM
i'm gonna try this out for my both rc5 websites

has anyone done this successfully in 2.0rc5 ? or other 2.0 candidate versions?
just a little concern bcuz this topic is kinda old and it targets 1.0version.. from 2004
Title: Re: Share user database for 2 (or more) different forums.
Post by: luuuciano on March 08, 2011, 02:08:37 PM
Hi!

Currently I have a project  that is based in "federated" forums... nearly 25 forums about the same topic... each forum points to certain region (geographically)
All of them in the same domain, maybe using sub domain for each one... and the main idea is to share members tables, etc... each forum having like 20 topic areas

I have readed this thread, as a couple other with other methods... almost all of them not supported anymore, or going to be on that status (as the feline subforums aproach)... and I can not decide what to do
So... what to do? :(

Can someone recommend me anything?
Or maybe exists another forum script that achieves this better? (but I love smf... thats because Im trying to find whays to use it)

Or maybe another aproach to the idea... mmm
Title: Re: Share user database for 2 (or more) different forums.
Post by: Stef001 on April 23, 2011, 08:03:26 AM
Have someone already find out how to share the uploaded avatars.
I use smf 2.0 RC5

Stef.
Title: Re: Share user database for 2 (or more) different forums.
Post by: samiran12 on April 28, 2011, 08:27:26 AM
that sounds good and i too will try this...but i just want to know whether it has any side effects???
Title: Re: Share user database for 2 (or more) different forums.
Post by: Eudemon on April 28, 2011, 04:54:23 PM
just to report back that i shared 2 forums of 2 different domains using this method
it's been running for a month now, and everything is good
Title: Re: Share user database for 2 (or more) different forums.
Post by: Stef001 on April 28, 2011, 05:01:07 PM
Did you also share the the uploaded avatars?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Eudemon on April 28, 2011, 05:32:33 PM
no, the avatar problem still remains
it kinda make sense tho, cuz the directory for avatar is different
for example, the directory of first forum's avatar is .../public_html/avatars
and the second forum specifies the same directory, but they're different folders with different files in ur server
unless u first share that db and then change the second forum avatar directory to make it point to the first forum

haven't test it, not sure if it works
Title: Re: Share user database for 2 (or more) different forums.
Post by: Stef001 on April 28, 2011, 06:06:04 PM
What you said works, perfect. Many many thanks.

Stef.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on April 28, 2011, 06:08:05 PM
If only it were that simple. The reason that you have issues is because some of the data is stored in the attachments table, and you are strongly not recommended to share THAT between two forums.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Stef001 on April 28, 2011, 06:13:10 PM
I have shared the attachment table, why is that not recommendated.
Also i have point the avatar directory to the same directory.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on April 28, 2011, 06:17:09 PM
Attachments are shared by message id.

An attachment on message 1 on one forum will appear on the other. It won't work properly, but it'll still appear.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Stef001 on April 28, 2011, 06:31:27 PM
Sh**, i hoped that i solved the problem.
I have tested and its true, the attachment from one forum shows up in that other forum.

Is there no solution for it??

Stef.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on April 28, 2011, 06:32:28 PM
Um... not sharing avatars, or moving the entire avatar saving system outside of the attachment table.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Stef001 on April 28, 2011, 06:38:16 PM
I am going to try to move the entire avatar system.
But not tonight.
If i can make that i share offcourse.

Thanks for the help.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Eudemon on April 28, 2011, 06:39:00 PM
i don't share attachment table tho

note: by default avatars are uploaded to the attachment directory
in this case the new uploads on second forum still goes to the second forum's attachment directory
you can change that under avatar settings
make that one point to the first forum's avatar directory, see if it works
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on April 28, 2011, 06:51:23 PM
And there's still an entry in the attachments table *regardless* of whether you use the same folder or not...
Title: Re: Share user database for 2 (or more) different forums.
Post by: luuuciano on April 30, 2011, 02:43:57 AM
Using this aproach: http://www.simplemachines.org/community/index.php?topic=16190.msg2523327#msg2523327

What happens when 2.0 final appears (did you hear the thunder?)?

It will be too complicated to update it? (suppose you have 10 forums sharing tables in that way...)
Title: Re: Share user database for 2 (or more) different forums.
Post by: luuuciano on May 04, 2011, 09:41:57 PM
Wich problem will have if I share the settings table too?

A lot of mods store settings there... Im trying to not use too many mods, but 3/4 of the regular 15 mods I use are storing settings there (or, a few, uses their own tables)

Title: Re: Share user database for 2 (or more) different forums.
Post by: mkmeister on May 08, 2011, 03:43:22 PM
I would definitely NOT share the settings table. There may be many settings that are unique to each forum installation (paths, domains, etc).
Title: Re: Share user database for 2 (or more) different forums.
Post by: luuuciano on May 10, 2011, 04:37:23 PM
Mmmmm, what about if I want to share avatars... and deactivate attachments (I mean files, attached to posts... to avoid issues of files being shared between boards)
It will be ok to share the attachements table, so users will be able to upload avatars and see them in all the forums?

(and all the forums using the same paths for uploaded avatars, I guess...)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on May 10, 2011, 11:31:57 PM
Quote from: luuuciano on May 10, 2011, 04:37:23 PM
Mmmmm, what about if I want to share avatars... and deactivate attachments (I mean files, attached to posts... to avoid issues of files being shared between boards)
It will be ok to share the attachements table, so users will be able to upload avatars and see them in all the forums?

(and all the forums using the same paths for uploaded avatars, I guess...)
I honestly dont think it'll work...
Title: Re: Share user database for 2 (or more) different forums.
Post by: Stef001 on May 13, 2011, 04:15:06 PM
Quote from: luuuciano on May 10, 2011, 04:37:23 PM
Mmmmm, what about if I want to share avatars... and deactivate attachments (I mean files, attached to posts... to avoid issues of files being shared between boards)
It will be ok to share the attachements table, so users will be able to upload avatars and see them in all the forums?

(and all the forums using the same paths for uploaded avatars, I guess...)

I did it that way and it works.

Stef.
Title: Re: Share user database for 2 (or more) different forums.
Post by: luuuciano on May 14, 2011, 02:35:21 PM
mmm nevermind, I will have to share it as it storing a lot of user options...

So, I will have to think how to change things in the template, based in each subdomain?...
at least the logo image... mmmm

By mistake I have shared the themes table (then I realized that I need different themes in each forum)

so... how to undone:
CREATE VIEW forum2STAFE_themes AS SELECT * FROM shared_themes;
How to break/destroy a view? it is like a simlink, right?

the old table was renamed to forum2STAFE_themes_OLD...
Title: Re: Share user database for 2 (or more) different forums.
Post by: luuuciano on May 17, 2011, 08:27:49 PM
Mmmmm, I will have several subforums... eahc one in his subdomain... sharing tables... but, I want to be able to show different adsense banners in each forum... so... I will have to not whare the themes table?

I will loose all the user theme settings... and customs profile fields (those fields are stored in that table...)

Any idea?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on May 18, 2011, 12:08:10 AM
Use subforums mod available at portamx.com. It is however build for SMF 2.0 RC3 and will never be updated until SMF 2.0 turn gold.
Title: Re: Share user database for 2 (or more) different forums.
Post by: forfun on May 21, 2011, 08:39:35 PM
Quote from: Eudemon on April 28, 2011, 04:54:23 PM
just to report back that i shared 2 forums of 2 different domains using this method
it's been running for a month now, and everything is good
Would you confirm that you are running RC5?
Thanks
Title: Re: Share user database for 2 (or more) different forums.
Post by: Eudemon on May 21, 2011, 10:12:35 PM
Quote from: forfun on May 21, 2011, 08:39:35 PM
Quote from: Eudemon on April 28, 2011, 04:54:23 PM
just to report back that i shared 2 forums of 2 different domains using this method
it's been running for a month now, and everything is good
Would you confirm that you are running RC5?
Thanks

yes, both sites are running rc5
Title: Re: Share user database for 2 (or more) different forums.
Post by: forfun on May 21, 2011, 10:51:04 PM
Quote from: Eudemon on May 21, 2011, 10:12:35 PM
Quote from: forfun on May 21, 2011, 08:39:35 PM
Quote from: Eudemon on April 28, 2011, 04:54:23 PM
just to report back that i shared 2 forums of 2 different domains using this method
it's been running for a month now, and everything is good
Would you confirm that you are running RC5?
Thanks

yes, both sites are running rc5
Thanks MUCH
Title: Re: Share user database for 2 (or more) different forums.
Post by: forfun on May 22, 2011, 01:53:11 AM
I have used the mod to share members between 2 forums (1.1.13), but I am doing the upgrade to RC5, and I need to revert the shares (create view) in the second forum,
How do I do it?
I can't find the instruction, which I think the author has posted, once.
Thanks much for any info
Title: Re: Share user database for 2 (or more) different forums.
Post by: Eudemon on May 22, 2011, 04:39:49 PM
it rly depends how that mod works
does it modify database tables?
u might have to contact the author for these info
if the mod makes both forum share same table then after upgrade just point to that table
if the mod automatic updates both forum's database tables to make them identical then just use either one of them

i'm not familiar with the mod and i have never used a 1.0ver smf so i'm not sure
also i think the table layouts should be little different between 1.0 and 2.0
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on June 08, 2011, 08:53:10 AM
Using the below, I successfully linked together 3 forums; including mods.

Still testing things, but going well so far.

=)

Quote from: mkmeister on March 04, 2010, 03:35:19 PM
OK, here's a step by step of exactly what I did. There were ZERO code changes, and only used MySQL to pull it off as noted in a previous post.

As a note, I'm using SMF 1.1.11 and MySQL 5.0.x. If SMF 2.x uses a similar table structure (haven't looked at it personally yet), I'd imagine it'd work just as well and still no code changes. They don't even need to be on the same database, but it's easier, and my instructions will assume they're using the same database with just different prefixes for the two (or more) installations of SMF. It does not matter what domain they are hosted on as long as they use the same MySQL server.

This will share user logins and PMs.

Assume you have two installations. One is an already established forum installation, and it uses the prefix "forumA_". The other is a new forum that you want to share forumA's logins and PMs. It has the prefix "forumB_". They're both in the database called "smf".

Log onto MySQL. There are a variety of tools for this but I just use commandline.
Now, once in MySQL, issue the following.
USE smf;

First, just move forumB's tables you want shared out of the way.
ALTER TABLE forumB_members RENAME TO forumB_members_old;
ALTER TABLE forumB_personal_messages RENAME TO forumB_personal_messages_old;
ALTER TABLE forumB_pm_recipients RENAME TO forumB_pm_recipients_old;


WARNING: Your forumA install will NOT be accessible once you do the following step until all steps are complete. It'd be wise to make a backup first too.
Next, rename forumA's tables to use a "shared_" prefix.
ALTER TABLE forumA_members RENAME TO shared_members;
ALTER TABLE forumA_personal_messages RENAME TO shared_personal_messages;
ALTER TABLE forumA_pm_recipients RENAME TO shared_pm_recipients;


Finally, create views of the shared tables for both forumA and forumB so they see the exact same tables and the info is the same for both.
First, forumA:
CREATE VIEW forumA_members AS SELECT * FROM shared_members;
CREATE VIEW forumA_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW forumA_pm_recipients AS SELECT * FROM shared_pm_recipients;


And next, forumB:
CREATE VIEW forumB_members AS SELECT * FROM shared_members;
CREATE VIEW forumB_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW forumB_pm_recipients AS SELECT * FROM shared_pm_recipients;


Presto! Finished! Both forumA and forumB share users and PMs!

If anybody can spot corrections or something wrong with the above instructions, let me know and I'll correct it.

EDIT: Corrected a couple of typos.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on June 08, 2011, 09:07:07 AM
Avatars won't be properly joined, least not uploaded ones (or oversize ones downloaded to the server).
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on June 08, 2011, 11:14:24 PM
The 'view new replies / posts' only works on Site B, but not on Site A or C.

I have no idea why... Does anyone have any ideas?

I get this:

QuoteAn Error Has Occurred!
The board you specified is located on a different forum
Title: Re: Share user database for 2 (or more) different forums.
Post by: luuuciano on June 27, 2011, 02:35:12 PM
Quote from: ahrasis on May 18, 2011, 12:08:10 AM
Use subforums mod available at portamx.com. It is however build for SMF 2.0 RC3 and will never be updated until SMF 2.0 turn gold.

Sadly subforums mod at portamx will be not developed anymore, right? :(
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on July 28, 2011, 02:06:24 PM
Quote from: luuuciano on June 27, 2011, 02:35:12 PM
Quote from: ahrasis on May 18, 2011, 12:08:10 AM
Use subforums mod available at portamx.com. It is however build for SMF 2.0 RC3 and will never be updated until SMF 2.0 turn gold.

Sadly subforums mod at portamx will be not developed anymore, right? :(

May be and may be not... I'll try to see about it later...
Title: Re: Share user database for 2 (or more) different forums.
Post by: luuuciano on July 30, 2011, 02:27:47 PM
Quote from: ahrasis on July 28, 2011, 02:06:24 PM
Quote from: luuuciano on June 27, 2011, 02:35:12 PM
Quote from: ahrasis on May 18, 2011, 12:08:10 AM
Use subforums mod available at portamx.com. It is however build for SMF 2.0 RC3 and will never be updated until SMF 2.0 turn gold.

Sadly subforums mod at portamx will be not developed anymore, right? :(

May be and may be not... I'll try to see about it later...

PMx-Subforums v1.2 for SMF 2.0 was released today! weeeeeeee
http://portamx.com/2722/pmx-subforums-v1-2-for-smf-2-0/

edit: fixed link to latest version
Title: Re: Share user database for 2 (or more) different forums.
Post by: ShadyX on July 30, 2011, 05:10:59 PM
A very nice tut! thanks.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Quinn on August 10, 2011, 01:14:17 PM
Yes! After 2.0 finally went Gold I upgraded two rc5 test sites and the main 1.15 site then did the database share and all 3 sites have no problems now. I did point the avatars & attachments to the main forum folders b4 the database switch but they didn't carry over.

I noticed during the upgrade of the rc5 sites I had done the database test on had troubles with the "view" tables and had to revert back the original tables before it would upgrade without errors.  Deleting the views and renaming the original tables from _old then remaking the views after the upgrade was all it took.

Only one of the rc5 forums had an issue with a mod that had to be removed to fix after the table changes. This mod was causing a database error between the settings file and the users not existing before it was installed. I was expecting this might happen so no real surprise there. The mod will no longer be supported by the developer after 2.0 Gold anyway.

It would be nice to find a way to enable one log in for all 3 forums. I have disabled new registrations except on the main forum to eliminate confusion and redirecting log-in links to the main forum. With the ability to link to a url when creating a board this is very easy to link from the main board. The main site is bridged with an extensive Coppermine Photo gallery.

The site is setup using forum.domain.com with sub forums in the same root ie: forum.domain.com/smf1 &  forum.domain.com/smf2

http://forums.bs-raven.net (http://forums.bs-raven.net)



ALTER TABLE smf2_members RENAME TO smf2_members_old;
ALTER TABLE smf2_personal_messages RENAME TO smf2_personal_messages_old;
ALTER TABLE smf2_pm_recipients RENAME TO smf2_pm_recipients_old;

ALTER TABLE smf3_members RENAME TO smf3_members_old;
ALTER TABLE smf3_personal_messages RENAME TO smf3_personal_messages_old;
ALTER TABLE smf3_pm_recipients RENAME TO smf3_pm_recipients_old;



ALTER TABLE smf_members RENAME TO shared_members;
ALTER TABLE smf_personal_messages RENAME TO shared_personal_messages;
ALTER TABLE smf_pm_recipients RENAME TO shared_pm_recipients;



CREATE VIEW smf_members AS SELECT * FROM shared_members;
CREATE VIEW smf_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW smf_pm_recipients AS SELECT * FROM shared_pm_recipients;

CREATE VIEW smf2_members AS SELECT * FROM shared_members;
CREATE VIEW smf2_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW smf2_pm_recipients AS SELECT * FROM shared_pm_recipients;

CREATE VIEW smf3_members AS SELECT * FROM shared_members;
CREATE VIEW smf3_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW smf3_pm_recipients AS SELECT * FROM shared_pm_recipients;

Title: Re: Share user database for 2 (or more) different forums.
Post by: luuuciano on August 10, 2011, 01:42:08 PM
Quinn have you seen/tried the PMx-Subforums mod?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Quinn on August 10, 2011, 02:48:14 PM
@ luuuciano

I just looked at it again and am considering it but need time to evaluate for my needs. Thanks
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on August 10, 2011, 03:40:31 PM
Quote from: luuuciano on August 10, 2011, 01:42:08 PM
Quinn have you seen/tried the PMx-Subforums mod?
And it's now version 1.3.  :D
Title: Re: Share user database for 2 (or more) different forums.
Post by: Quinn on August 10, 2011, 04:16:24 PM
Hmmm... that didn't go well. I downloaded PMxSubforums131 and installed in a fresh install of smf 2.0 and it broke the site. Blank page when returning to Admin page after installing the package. Restored from the backup and trying it one more time.


Still No joy after trying on a fresh forum install...
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on August 28, 2011, 06:26:24 AM
I have three forums linked, two of them are main-use.

I've just finished a personalised theme, and am very happy with it, etc etc yada yada...

here's my issue...

Despite the fact that THEMEs are NOT linked... the two sites will NOT hold the same theme, at the same time.... WTF...?? LOL.

I update one, so iy has the theme, I reload the other page... and it's reverted to the base Default theme... I update it, lo and behold, the other has updated to the base default...

IT IS DRIVING ME NUTTERS...


Any idea what is going on here???



I am running RC5 still.




EDIT: They will hold DIFFERENT custom themes, just not share the SAME custom theme... Am I making a general error here somewhere, perhaps? =/

Cancel that. No, they won't even hold different customs... I AM SO CONFUSED!
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on August 28, 2011, 07:35:18 PM
If you're talking about Pmx SubForums Mod, it is better to ask for support in portamx site.
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on August 29, 2011, 12:08:55 AM
I assume you're talking about the post above mine, but I'll just classify that I'm having (I believe) issues with liked databases... Though I am very confused. They WERE holding individual personalized themes, however, after zipping one theme, and installing it on the other forum, the two now "bounce" the theme between themselves. They will not hold it at the same time, or, now, any individual theme. One site will carry it, while theories defaults back to the Core theme, but has blank nothingness inAdministration where it should say what theme is the default.

Any help would be amazing.


Sorry for any weird words. Auto correct.
Title: Re: Share user database for 2 (or more) different forums.
Post by: luuuciano on August 29, 2011, 12:50:38 AM
So... you have not linked theme table? and your user theme setup backs to default when changing between forums?
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on August 29, 2011, 04:30:21 AM
Correct, the Themes table on the db has not been shared.


I have two sites; "OOC" and "MAIN". "MAIN" is not a sub-domain, OOC is.

I set OOC to be "Green Theme", and save it.
The page loads up afterwards, and the theme is visible.

I change tabs, and refresh MAIN, which had also been sporting Green Theme.
It re-loads in default Curve.

Re-assign Green Theme to MAIN, and it loads up.
Change tab, refresh OOC, and it is now default theme.

The site that defaults back to the Base theme, also UNchecks the "Green Theme" as a selectable Theme from the list.


This error wasn't happening before I zipped the Green Theme itself, and attempted to install it on the second site. So there COULD be something there that I screwed up, somehow, or something. But I don't know. It now does this error when I try to get the site to hold ANY personalised theme, not just the Green Theme. Until I uploaded GT on the OOC site, said OOC site was holding a modified Blue Theme.

The only real "error" that is showing up visually when I looked into things, is the profile screen shot, where the refreshed site is defaulting NO theme. It seems all fine and dandy in the admin portion, however. Screenshots #1 & #2.

(http://second-pass.net/images/Look&Layout.png)
(http://second-pass.net/images/AdminTheme.png)
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on September 01, 2011, 08:44:27 PM
*bump* Is anyone able to help me at all??

I, somehow, managed to get it to work... I have NO idea how, though o_o
Title: Re: Share user database for 2 (or more) different forums.
Post by: Quinn on September 05, 2011, 12:02:42 PM
I have a theme set for each forum (3) and don't allow users to select their own. No problems. The main forum has 2 separate forums in sub directories.  To simplify use and allow for a single log in on these I have shared these database tables :

ALTER TABLE smf2_members RENAME TO smf2_members_old;
ALTER TABLE smf2_personal_messages RENAME TO smf2_personal_messages_old;
ALTER TABLE smf2_pm_recipients RENAME TO smf2_pm_recipients_old;

ALTER TABLE smf3_members RENAME TO smf3_members_old;
ALTER TABLE smf3_personal_messages RENAME TO smf3_personal_messages_old;
ALTER TABLE smf3_pm_recipients RENAME TO smf3_pm_recipients_old;

ALTER TABLE smf_members RENAME TO shared_members;
ALTER TABLE smf_personal_messages RENAME TO shared_personal_messages;
ALTER TABLE smf_pm_recipients RENAME TO shared_pm_recipients;

CREATE VIEW smf_members AS SELECT * FROM shared_members;
CREATE VIEW smf_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW smf_pm_recipients AS SELECT * FROM shared_pm_recipients;

CREATE VIEW smf2_members AS SELECT * FROM shared_members;
CREATE VIEW smf2_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW smf2_pm_recipients AS SELECT * FROM shared_pm_recipients;

CREATE VIEW smf3_members AS SELECT * FROM shared_members;
CREATE VIEW smf3_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW smf3_pm_recipients AS SELECT * FROM shared_pm_recipients;

ALTER TABLE smf_log_online RENAME TO shared_log_online;
ALTER TABLE smf2_log_online RENAME TO smf2_log_online_old;
ALTER TABLE smf3_log_online RENAME TO smf3_log_online_old;

CREATE VIEW smf_log_online AS SELECT * FROM shared_log_online;
CREATE VIEW smf2_log_online AS SELECT * FROM shared_log_online;
CREATE VIEW smf3_log_online AS SELECT * FROM shared_log_online;

ALTER TABLE smf_attachments RENAME TO shared_attachments;
ALTER TABLE smf2_attachments RENAME TO smf2_attachments_old;
ALTER TABLE smf3_attachments RENAME TO smf3_attachments_old;

CREATE VIEW smf_attachments AS SELECT * FROM shared_attachments;
CREATE VIEW smf2_attachments AS SELECT * FROM shared_attachments;
CREATE VIEW smf3_attachments AS SELECT * FROM shared_attachments;

ALTER TABLE smf_sessions RENAME TO shared_sessions;
ALTER TABLE smf2_sessions RENAME TO smf2_sessions_old;
ALTER TABLE smf3_sessions RENAME TO smf3_sessions_old;

CREATE VIEW smf_sessions AS SELECT * FROM shared_sessions;
CREATE VIEW smf2_sessions AS SELECT * FROM shared_sessions;
CREATE VIEW smf3_sessions AS SELECT * FROM shared_sessions;

Before doing this I also pointed the settings for attachments & avatars to the main forums directories. I use sub domain independent cookies (PROBABLY NOT NECESSARY IN MY SITUATION) with the same cookie name, database sessions & for all forums. Disabled registration on all but the main forum and can log in/out to all at the same time. I did not share the permissions or member groups so I can control user permissions on the other boards separately.

To keep the script kiddie's reg bots out, I  use the MOD's httpBL with Honey Pot with a few simple questions for registration on the main forum. 6719 Spammers blocked up until today

Everything is working very well.
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on September 10, 2011, 04:42:53 AM
@Quinn

I have the following tables shared... but still my forums aren't sharing a session.

The Forum Cookies are different {959, 335, 350}; but I'm kind of afraid to change the cookies in case I kill the site, which I've just opened. =/ They share everything else; database and all that junk. Like I said, everything is working properly -- except the accounts staying logged in across the sites.

shared_ads
shared_ads_settings
shared_awards
shared_awards_categories
shared_awards_members
shared_cf_fields
shared_cf_forms
shared_group_moderators
shared_membergroups
shared_members
shared_messages
shared_personal_messages
shared_pm_recipients
shared_post_drafts
shared_sessions
shared_settings
shared_subaccounts
shared_subscriptions
shared_tp_articles
shared_tp_blocks
shared_tp_data
shared_tp_dldata
shared_tp_events
shared_tp_modules
shared_tp_rates
shared_tp_ratestats
shared_tp_settings
shared_tp_shoutbox
shared_tp_variables



EDIT: The forums are sharing posted topics in related-numbered forums, too >_>... Which I don't understand... What did I share that I shouldn't have to cause that? O_O

EG, Site A and Board ID 1 has the post "Rules"
Site B and Board ID 1 brings up the post "Rules" when a new topic is posted in Site B's ID1 board...


WAIT; that would be "Messages", wouldn't it? How do I *un*share something??
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on September 10, 2011, 05:49:23 AM
Quote from: ahrasis on June 15, 2010, 09:23:04 AM
I listed the note on the Caveat & Gotchas of this database mod:
Quote from: Arantor on March 23, 2010, 06:09:41 PM
This thread does discuss multiple ways of doing it, but all require significant change or come with significant caveats and gotchas. There's no simple way that actually works cleanly without any side effects :(
Avatar Caveat:
Quote from: Arantor on March 05, 2010, 07:15:54 AM
Note that member avatars are shared if they use an external URL or pick from the gallery (since that's stored in the members table, along with their post count) but not if they upload their own (since that's stored in the attachments table)
Membergroup Caveat:
Quote from: Arantor on March 09, 2010, 10:12:29 AM
Yup, that's the idea but do see the caveats from me above, like about membergroups and so on.
Attachment Caveat:
Quote from: Arantor on March 27, 2010, 05:47:31 PM
Assuming you have two topic and two message tables, you'll be duplicating attachments unless you modify all the attachment handling code too (have fun with that)

Basically, an attachment is attached to a post by id. If you attach a file to message id 1000, the same attachment is visible in BOTH sides' message 1000.
Cookie Caveat:
Quote from: Mr. Doug on March 28, 2010, 08:26:56 AM
I've had no issues with cookies. Just make sure your cookies aren't named the same way. (keep them all different.)
Theme & Board Caveat:
Quote from: Mr. Doug on March 29, 2010, 08:38:17 AM
I found a caveat to a shared member DB. Make sure all the Themes on your boards are numbered the same way. If I make a change the default to one (and reset the members options), all 3 get the change pushed.
Custom Profile Caveat:
Quote from: Arantor on March 29, 2010, 08:41:20 AM
Note also that custom profile fields are also in that table...
Statistic Caveat:
Quote from: Mr. Doug on March 31, 2010, 08:36:06 AM
I ran into the same thing. If you run the "update statistics" maintenance, it fixes it. So now I just run that every few days until I can get around to writing a cron script that does it for me. Everything functions correctly, it just doesn't update the number of users in the bottom of the page..
Hope this will help. Happy testing! ;)
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on September 10, 2011, 06:29:30 AM
Thanks, Ahrasis, that's quite helpful =)

QuoteAttachment Caveat:
Quote from: Arantor on March 28, 2010, 07:47:31 AM
Assuming you have two topic and two message tables, you'll be duplicating attachments unless you modify all the attachment handling code too (have fun with that)

Basically, an attachment is attached to a post by id. If you attach a file to message id 1000, the same attachment is visible in BOTH sides' message 1000.

Does this mean I should share the Topic and Message tables? I'm not sharing Avatars or Attachments, so I shouldn't be having the issue related to that... Yet my topics are all duplicating.

And if I make any changes, am I going to keep all the current posts, or are they at risk of being eaten some how?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on September 10, 2011, 06:41:38 AM
Fireditto, just follow the link to each quoted facts given about Caveat & Gotchas to see whether it has been answered. The concern is that any pictures, avatars, smileys, attachments, etc. will be duplicated together with the topics and messages.

In this mod, thuswise, it is advisable that we do not allow members to upload any pictures, avatars, smileys, attachments, etc. as this will only complicates thing; but rather only allow members to use external / internal links for them.

I have tested this mod only once upon a time, may be I'll give it another look later on. But as a note, the original purpose of this mod is to mainly share user from one database, thus, I am not very sure if others such as topics and messages can be shared harmoniously.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Quinn on September 10, 2011, 12:11:53 PM
Cookie Caveat:
Quote from: Mr. Doug on March 28, 2010, 08:26:56 AM
I've had no issues with cookies. Just make sure your cookies aren't named the same way. (keep them all different.)
These posts all relate to SMF v.1.1.xx and may not be relevant to SMF 2.0.xx

@FireDitto

I don't know how it would work if you didn't. I use database sessions and the same cookie_name with no issues. If you run into a problem renaming them to be different and clear your browsers cookies cache will fix it.

All forums attachments & avatars point to the same place in settings. Every attachment for a post has a unique identifier name and have yet to see issues with confused posts.

I have no issues with themes since I set one per site and don't allow users to select their own.

You answered your own question.. don't share the smf_message tables or all boards will be confused. Simply remove the shared tables by reversing the table changes. I would bet that all posts created after the view was created will be lost to the other boards and remain on the main board.?

When you reset the original table name your views will be orphaned and a database error will fill the logs until these views are deleted.

Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on September 10, 2011, 12:48:35 PM
If you read, it does relate to SMF 2.0.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Quinn on September 10, 2011, 12:58:31 PM
Quote from: ahrasis on September 10, 2011, 12:48:35 PM
If you read, it does relate to SMF 2.0.

and some refer to 1.1.11 further down the page from that particular post stating they had no issues.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on September 10, 2011, 01:25:02 PM
Quote from: Quinn on September 10, 2011, 12:11:53 PM
Cookie Caveat:
Quote from: Mr. Doug on March 28, 2010, 08:26:56 AM
I've had no issues with cookies. Just make sure your cookies aren't named the same way. (keep them all different.)
These posts all relate to SMF v.1.1.xx and may not be relevant to SMF 2.0.xx
Mr Doug was using RC3 at that time.  I was the one asking and testing at that time too. The caveat is that you should use different cookies. He has no problem as he was using that approach.

Read again before you mislead somebody else. I won't be replying or arguing to this anymore.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Quinn on September 10, 2011, 02:24:39 PM
Quote from: ahrasis on September 10, 2011, 01:25:02 PM
Read again before you mislead somebody else. I won't be replying or arguing to this anymore.

A bit testy, aren't you? No one is arguing here.. just a friendly clarification is all that is required.

I am only relating what works for my 3 linked forums...!

As this thread has had both 1.x and 2.x posts for the same discussion it is a bit confusing for anyone trying to discover the "FIX" for this issue.




good bye...
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on September 12, 2011, 07:41:53 AM
Okay, so... sorry for sounding dense, but how do I change "Shared messages" to "unshared messages"?



ALTER TABLE shared_messages RENAME TO smf_messages;
ALTER TABLE SMF2_messages_old RENAME TO SMF2_messages;
ALTER TABLE SMF3_messages_old RENAME TO SMF3_messsages;

CREATE VIEW smf_messages AS SELECT * FROM shared_messages;
CREATE VIEW SMF2_messages AS SELECT * FROM SMF2_messages_old;
CREATE VIEW SMF3_messages AS SELECT * FROM SMF3_messages_old;


... Does that look about right?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Quinn on September 12, 2011, 08:52:56 AM
First, Delete the views you created, then you can rename messages_old to smf_messages

ALTER TABLE shared_messages RENAME TO smf_messages;
ALTER TABLE SMF2_messages_old RENAME TO SMF2_messages;
ALTER TABLE SMF3_messages_old RENAME TO SMF3_messsages;


Title: Re: Share user database for 2 (or more) different forums.
Post by: luuuciano on September 12, 2011, 09:05:13 AM
DROP VIEW viewname;
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on September 13, 2011, 04:42:52 AM
I dropped the "shared_messages;" table... Am I meant to drop any others? The original message ones?


Error
SQL query:

ALTER TABLE adminSP_messages_old RENAME TO adminSP_messages;


MySQL said:

#1050 - Table 'adminSP_messages' already exists
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on September 13, 2011, 04:50:52 AM
Nvm.
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on September 15, 2011, 07:45:59 AM
Okay; I re-did my site. Aside from the mess up with the messages sharing, I think I did okay with the linked databases.

However, I was just looking for second opinion or whatever regarding the sharing of the following;

ads
ads_settings
awards
awards_categories
awards_members
group_moderators
log_karma
log_online
membergroups
members
personal_messages
pm_recipients
post_drafts
sessions
settings
subaccounts
subscriptions
tags
tags_log
themes
tp_articles
tp_blocks
tp_data
tp_dldata
tp_dlmanager
tp_events
tp_modules
tp_rates
tp_ratestats
tp_settings
tp_shoutbox
tp_variables


Do any of these strike as trouble-makers when shared? Should something be shared that I haven't included?

Basic forum set up;
Forum A = out of character chatter, information and everything that doesn't fit in the other two boards.
Forum B = Role Playing central.
Forum C = behind the scenes, where admin, moderators, staff, etc can spend time out of prying eyes.
Title: Re: Share user database for 2 (or more) different forums.
Post by: nw on September 15, 2011, 08:13:33 AM
Hey guys, I have a quick question. I installed 3 forums and did this:

Quote from: Quinn on September 05, 2011, 12:02:42 PM
I have a theme set for each forum (3) and don't allow users to select their own. No problems. The main forum has 2 separate forums in sub directories.  To simplify use and allow for a single log in on these I have shared these database tables :

ALTER TABLE smf2_members RENAME TO smf2_members_old;
ALTER TABLE smf2_personal_messages RENAME TO smf2_personal_messages_old;
ALTER TABLE smf2_pm_recipients RENAME TO smf2_pm_recipients_old;

ALTER TABLE smf3_members RENAME TO smf3_members_old;
ALTER TABLE smf3_personal_messages RENAME TO smf3_personal_messages_old;
ALTER TABLE smf3_pm_recipients RENAME TO smf3_pm_recipients_old;

ALTER TABLE smf_members RENAME TO shared_members;
ALTER TABLE smf_personal_messages RENAME TO shared_personal_messages;
ALTER TABLE smf_pm_recipients RENAME TO shared_pm_recipients;

CREATE VIEW smf_members AS SELECT * FROM shared_members;
CREATE VIEW smf_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW smf_pm_recipients AS SELECT * FROM shared_pm_recipients;

CREATE VIEW smf2_members AS SELECT * FROM shared_members;
CREATE VIEW smf2_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW smf2_pm_recipients AS SELECT * FROM shared_pm_recipients;

CREATE VIEW smf3_members AS SELECT * FROM shared_members;
CREATE VIEW smf3_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW smf3_pm_recipients AS SELECT * FROM shared_pm_recipients;

ALTER TABLE smf_log_online RENAME TO shared_log_online;
ALTER TABLE smf2_log_online RENAME TO smf2_log_online_old;
ALTER TABLE smf3_log_online RENAME TO smf3_log_online_old;

CREATE VIEW smf_log_online AS SELECT * FROM shared_log_online;
CREATE VIEW smf2_log_online AS SELECT * FROM shared_log_online;
CREATE VIEW smf3_log_online AS SELECT * FROM shared_log_online;

ALTER TABLE smf_attachments RENAME TO shared_attachments;
ALTER TABLE smf2_attachments RENAME TO smf2_attachments_old;
ALTER TABLE smf3_attachments RENAME TO smf3_attachments_old;

CREATE VIEW smf_attachments AS SELECT * FROM shared_attachments;
CREATE VIEW smf2_attachments AS SELECT * FROM shared_attachments;
CREATE VIEW smf3_attachments AS SELECT * FROM shared_attachments;

ALTER TABLE smf_sessions RENAME TO shared_sessions;
ALTER TABLE smf2_sessions RENAME TO smf2_sessions_old;
ALTER TABLE smf3_sessions RENAME TO smf3_sessions_old;

CREATE VIEW smf_sessions AS SELECT * FROM shared_sessions;
CREATE VIEW smf2_sessions AS SELECT * FROM shared_sessions;
CREATE VIEW smf3_sessions AS SELECT * FROM shared_sessions;


Although I skipped the "attachments" tables for now.

My question: Is there a way to allow the user to sign in only once and yet be able to access all three board? Looking at what Quinn said, I should be able to accomplish this by altering these tables. I logged into the first forum but when I try to navigate the second and third forums, I need to log in again.

Thanks!
Title: Re: Share user database for 2 (or more) different forums.
Post by: Quinn on September 17, 2011, 01:15:07 PM
Quote
Before doing this I also pointed the settings for attachments & avatars to the main forums directories. I use sub domain independent cookies (PROBABLY NOT NECESSARY IN MY SITUATION) with the same cookie name, database sessions & for all forums. Disabled registration on all but the main forum and can log in/out to all at the same time. I did not share the permissions or member groups so I can control user permissions on the other boards separately.

Some would say that all cookies named the same won't work but... it works for me. Good Luck!
Title: Re: Share user database for 2 (or more) different forums.
Post by: nw on September 17, 2011, 05:39:35 PM
Brilliant. Thanks, Quinn! It works perfect after I changed the cookies names. I'm wondering if there is any implications in having the same cookie name for all the forums?
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on September 17, 2011, 06:16:51 PM
How do you change the cookie name without slaughtering the site? I've never had any success with that.
Title: Re: Share user database for 2 (or more) different forums.
Post by: nw on September 17, 2011, 06:39:26 PM
I changed the cookie name for the 2nd and 3rd forum to the main forum in the Settings.php file. That was all I did FireDitto. It is working fine now, I've logged out and logged in multiple times to try it. I will report if there is a problem with this.
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on September 18, 2011, 04:22:33 AM
Hrm. I changed the cookie name of the second forum to that of the first, and allowed for subdomain independents. They are sharing the sessions on the database.

However, I've cleared the cache and done refreshes, but they aren't linking for me... well, not in a good way, anyway. Instead of going "Oh, you're logged in on A, I'll log you in on B" it goes "OMG! INTRUDER! *logs out on all forums*"

Say I logged in on ForumA. I'm totally fine to stay logged in there -- until I go refresh the page on ForumB, which results in ForumA being logged out, and ForumB remaining logged out and/or logging out and asking to be logged in.

o_o where did I mess up?


EDIT: I also tried without the subdomain independents. Now, I'm allowed to be logged in on both... but I have to manually log in to both; it isn't picking up that I'm logged into one and echoing it.
Title: Re: Share user database for 2 (or more) different forums.
Post by: nw on September 18, 2011, 05:44:31 AM
Mine seems to work fine with the Subaccounts mod too. I've left the "Enable local storage of cookies" and "Use subdomain independent cookies" unticked in all forums, while "Use database driven sessions" and "Allow browsers to go back to cached pages" are both ticked.
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on September 18, 2011, 06:22:16 AM
Hrm. My settings are the same there, too. Same ones off, same ones on. I wonder what's going on?

Did you share the Subaccounts on the database? I don't know if that would effect it, but I figured I'd ask anyway.

... it probably  has something to do with the fact that, somehow, I missed sharing the database members >_>

Damnit. Or not. Shared members, now, but still not sharing sessions.
Title: Re: Share user database for 2 (or more) different forums.
Post by: nw on September 18, 2011, 06:04:00 PM
Yep, I shared the subaccounts db table. Also the session table.

Edit: If it's still not working. Maybe try it on new forums. I wonder if it might be one of the mods?
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on September 18, 2011, 07:56:29 PM
I got it!

I had the OpenID enabled, but not shared. I disabled it, and now it works.

Thanks for your assistance =D
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on September 19, 2011, 05:07:28 AM
How were you able to allow registration on one, but not the other two?

I am unable to duplicate this.

=/
Title: Re: Share user database for 2 (or more) different forums.
Post by: TaGBaN on September 19, 2011, 03:42:19 PM
I just went thru and did this, also included spiders, ban_items, sesisons, etc.

First: Cookies are definately not working for me, neither are sessions cross domains.
- Both DOMAINS are on the same webserver, so sharing DB was easy.
Second: I was trying to follow [Unknown]'s initial instructions for sharing "Last Member Registered", and "Register Count", but was unable to. I am using SMF 2.0.1.

My domains: http://www.bnet.cc // http://www.eArena.net/

Any help is welcome!
Title: Re: Share user database for 2 (or more) different forums.
Post by: nw on September 19, 2011, 07:51:05 PM
@FD:

Ideally, we should edit the register() function and redirect it to the first board, but I'm too lazy to do that so I just hardcode the link.

In the Source/Subs.php file, change the 'register' => array(
'title' => $txt['register'],
'href' => $scripturl . '?action=register',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
),


to false like this:

'register' => array(
'title' => $txt['register'],
'href' => $scripturl . '?action=register',
'show' => false,
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
),


If you want to completely disable the registration button on the child boards. Or you can also redirect them to the main board using this code:

'register' => array(
'title' => $txt['register'],
'href' => 'your main site registration link here',
'show' => $user_info['is_guest'],
'sub_buttons' => array(
),
'is_last' => !$context['right_to_left'],
),



You will also need to edit your theme. This is the edit in the default theme:

Themes/default/language/index.english.php

Look for:

$txt['login_or_register'] = 'Please <a href="' . $scripturl . '?action=login">login</a> or <a href="' . $scripturl . '?action=register">register</a>.';

And remove the registration link:

$txt['login_or_register'] = 'Please <a href="' . $scripturl . '?action=login">login</a>';



@ TaGBaN

Haven't tried the instruction for the register count Yet. Sorry!
Title: Re: Share user database for 2 (or more) different forums.
Post by: TaGBaN on September 19, 2011, 09:48:48 PM
Its ok, I did EVERYTHING with database redirects, so thatthere isn't any confusion. I used the SQL "VIEW" command and linked them together that way. So that if SMF updates, it shouldn't mess up anything. Definately works smoothly, just really worried about the 'Cookies' and Database sessions not working right now. Anyone have ideas about those?
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on September 20, 2011, 07:30:34 PM
Tagban... If you also linked "messages" you're going to run into the issue I had: the topics with the same number will be duplicated across all linked forums. 
Title: Re: Share user database for 2 (or more) different forums.
Post by: FireDitto on January 06, 2012, 07:11:05 AM
I changed hosts... But in re-setting everything, it appears that my forums are not going to read the 'shared' settings required in the database...

How can I fix this??
Title: Re: Share user database for 2 (or more) different forums.
Post by: Wh0CaREs on March 29, 2012, 05:28:31 PM
I have question well when i go to online members i see

User    Time    Action
Online SworDFisH    04:27:18 PM    Viewing Who's Online.
Online Gallardo     04:19:38 PM    Viewing the topic Welcome to SMF!.

And when i want to lick one Welcome to SMF it redirect me to 2 forum because i watch secund forum, but this theme was on first forum... How i can fix that it link to right forum and right post?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Eudemon on March 29, 2012, 08:38:42 PM
that's one of the conflict issue with sharing log_online
for example
when an user view one topic, its action will be recorded and stored to database with the board, topic id, but not domain
so even he is actually viewing one topic in 2nd forum, when the 1st forum fetches info from that table, that row will be loaded as if he is on the 1st forum doing the action in that specific topic/board id

there are two solutions to this problem i can think of (if you have other idea please share it)
1, do not share log_online, each site will display its own traffic, obviously less than when share the log which combines two sites' traffics
2, modify that part of smf function, for example, add domain name to the query when storing to db, and also modify the function when fetch from db, simply read and add domain to the action link, to make it fancy, if you want to make it display whole link only when it's not the same domain, just add a condition check before hand

of course, it's easier to say than do it, but this theory(logic) should probably work
Title: Re: Share user database for 2 (or more) different forums.
Post by: luuuciano on March 29, 2012, 09:58:23 PM
I do not remember how pmx-subforums mod handle it... (in fact, I have disabled the who section of our forum)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Wh0CaREs on March 31, 2012, 06:36:49 AM
Quote from: Eudemon on March 29, 2012, 08:38:42 PM
that's one of the conflict issue with sharing log_online
for example
when an user view one topic, its action will be recorded and stored to database with the board, topic id, but not domain
so even he is actually viewing one topic in 2nd forum, when the 1st forum fetches info from that table, that row will be loaded as if he is on the 1st forum doing the action in that specific topic/board id

there are two solutions to this problem i can think of (if you have other idea please share it)
1, do not share log_online, each site will display its own traffic, obviously less than when share the log which combines two sites' traffics
2, modify that part of smf function, for example, add domain name to the query when storing to db, and also modify the function when fetch from db, simply read and add domain to the action link, to make it fancy, if you want to make it display whole link only when it's not the same domain, just add a condition check before hand

of course, it's easier to say than do it, but this theory(logic) should probably work
Then i wont share log :D
Title: Multi forum anyone here remember - SMFXXL Multi Forum System
Post by: DenDen60 on May 11, 2012, 10:43:23 AM
I need to develop a forum that includes a  lot of sub forums. Anyone  remembers smfxxl? Someone used to specialize in this a few years back?

Thanks

Denis
Title: Re: Share user database for 2 (or more) different forums.
Post by: jan0s1k on May 14, 2012, 06:15:49 PM
Hey, anyone tried to get to work "Latest member" in 2.0.x? Seems, that none of these methods doesn't work (I tried to make it for my own as well.. but I keep failing :P).
Title: Re: Share user database for 2 (or more) different forums.
Post by: Robert lee on May 23, 2012, 08:59:53 AM
First of all, thanks SO much for this publish - it was exactly what I required.  I now have two boards for two sub-domains on the same website using one participant desk, which is just what I desired.  however, I did observe one factor.If someone signs up on one message board, the participant depend instantly contributes another one on,but on the other message board it doesn't and I have to tell it to recall the some.
Title: Re: Share user database for 2 (or more) different forums.
Post by: airtetdotin on September 17, 2012, 10:04:16 AM
Hi Anguz

I need your help for Shae db files between two forums
I had installed two forums in separate server and i pointed  two database paths to single one  but only one working
second one gets Connection error.
I have used same table prefix in database
Help Me Please.......!
Title: Re: Share user database for 2 (or more) different forums.
Post by: TomW on November 07, 2012, 04:51:33 PM
I used the SQL method and it is working well, but have a question about the cookies.  Should I use the same cookie for all of my 3 forums (I am using SMF ver 2.0.2) ?
Title: Re: Share user database for 2 (or more) different forums.
Post by: Herman's Mixen on November 07, 2012, 10:45:06 PM
Quote from: TomW on November 07, 2012, 04:51:33 PM
Should I use the same cookie for all of my 3 forums (I am using SMF ver 2.0.2) ?

Yes. You do use the same cookies




@airtetdotin

Anguz is not much around here anymore

forum1 use database prefix smf1_
forum2 use database prefix smf2_
Title: Re: Share user database for 2 (or more) different forums.
Post by: TomW on November 11, 2012, 12:33:53 AM
Thank you !
Title: Re: Share user database for 2 (or more) different forums.
Post by: airtetdotin on December 07, 2012, 06:39:39 AM
Shared two forums exactly

But the problems is settings and themes

when i change the description of forum1 forum2 changed
theme would be same
Title: Re: Share user database for 2 (or more) different forums.
Post by: Benchapon on May 10, 2014, 02:48:36 AM
Thanks ;D
Title: Re: Share user database for 2 (or more) different forums.
Post by: RandomUser123 on July 10, 2014, 06:43:45 AM
Thanks for the tutorial!

It's only a bit outdated {$db_prefix} is now {db_prefix} and im_recipients is now pm_recipients and instant_messages is personal_messages.

And I can't get the cookie to work.
Title: Re: Share user database for 2 (or more) different forums.
Post by: margarett on July 10, 2014, 08:57:01 AM
This tutorial is ancient and it was written for a previous SMF version.

Isn't it easier to use a "subforum" mod?
http://custom.simplemachines.org/mods/index.php?mod=3730
http://custom.simplemachines.org/mods/index.php?mod=3148
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on July 15, 2014, 10:00:42 PM
Yes. And no.

Some method in this topic discussion are still related and useful. For example this method:
Quote from: Quinn on September 05, 2011, 12:02:42 PM
I have a theme set for each forum (3) and don't allow users to select their own. No problems. The main forum has 2 separate forums in sub directories.  To simplify use and allow for a single log in on these I have shared these database tables :

ALTER TABLE smf2_members RENAME TO smf2_members_old;
ALTER TABLE smf2_personal_messages RENAME TO smf2_personal_messages_old;
ALTER TABLE smf2_pm_recipients RENAME TO smf2_pm_recipients_old;

ALTER TABLE smf3_members RENAME TO smf3_members_old;
ALTER TABLE smf3_personal_messages RENAME TO smf3_personal_messages_old;
ALTER TABLE smf3_pm_recipients RENAME TO smf3_pm_recipients_old;

ALTER TABLE smf_members RENAME TO shared_members;
ALTER TABLE smf_personal_messages RENAME TO shared_personal_messages;
ALTER TABLE smf_pm_recipients RENAME TO shared_pm_recipients;

CREATE VIEW smf_members AS SELECT * FROM shared_members;
CREATE VIEW smf_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW smf_pm_recipients AS SELECT * FROM shared_pm_recipients;

CREATE VIEW smf2_members AS SELECT * FROM shared_members;
CREATE VIEW smf2_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW smf2_pm_recipients AS SELECT * FROM shared_pm_recipients;

CREATE VIEW smf3_members AS SELECT * FROM shared_members;
CREATE VIEW smf3_personal_messages AS SELECT * FROM shared_personal_messages;
CREATE VIEW smf3_pm_recipients AS SELECT * FROM shared_pm_recipients;

ALTER TABLE smf_log_online RENAME TO shared_log_online;
ALTER TABLE smf2_log_online RENAME TO smf2_log_online_old;
ALTER TABLE smf3_log_online RENAME TO smf3_log_online_old;

CREATE VIEW smf_log_online AS SELECT * FROM shared_log_online;
CREATE VIEW smf2_log_online AS SELECT * FROM shared_log_online;
CREATE VIEW smf3_log_online AS SELECT * FROM shared_log_online;

ALTER TABLE smf_attachments RENAME TO shared_attachments;
ALTER TABLE smf2_attachments RENAME TO smf2_attachments_old;
ALTER TABLE smf3_attachments RENAME TO smf3_attachments_old;

CREATE VIEW smf_attachments AS SELECT * FROM shared_attachments;
CREATE VIEW smf2_attachments AS SELECT * FROM shared_attachments;
CREATE VIEW smf3_attachments AS SELECT * FROM shared_attachments;

ALTER TABLE smf_sessions RENAME TO shared_sessions;
ALTER TABLE smf2_sessions RENAME TO smf2_sessions_old;
ALTER TABLE smf3_sessions RENAME TO smf3_sessions_old;

CREATE VIEW smf_sessions AS SELECT * FROM shared_sessions;
CREATE VIEW smf2_sessions AS SELECT * FROM shared_sessions;
CREATE VIEW smf3_sessions AS SELECT * FROM shared_sessions;

Before doing this I also pointed the settings for attachments & avatars to the main forums directories. I use sub domain independent cookies (PROBABLY NOT NECESSARY IN MY SITUATION) with the same cookie name, database sessions & for all forums. Disabled registration on all but the main forum and can log in/out to all at the same time. I did not share the permissions or member groups so I can control user permissions on the other boards separately.

To keep the script kiddie's reg bots out, I  use the MOD's httpBL with Honey Pot with a few simple questions for registration on the main forum. 6719 Spammers blocked up until today

Everything is working very well.

With this example, database can be shared without modifying SMF files.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on July 15, 2014, 10:03:42 PM
Except, as repeated numerous times throughout this topic, there are unpleasant side effects to doing this.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on July 15, 2014, 10:11:57 PM
Indeed. All modifications have their own effects. Pleasant or unpleasant will depends on each mods.

But for learning and gaining knowledge, it is still useful, undoubtedly.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on July 15, 2014, 10:15:26 PM
Except it gives users bad impressions.

Sharing post counts between forums is bad enough, but sharing avatars (brokenly) between them is even less clever, as is the absolute requirement to share all user groups between forums. Paid subscriptions also shouldn't be used on any of the forums.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on July 15, 2014, 10:27:09 PM
Not really. I have taken liberty to list all of these caveats so that people will know them if they are trying to apply this mod. If they read thoroughly, they should know them.

Quote from: ahrasis on September 10, 2011, 05:49:23 AM
Quote from: ahrasis on June 15, 2010, 09:23:04 AM
I listed the note on the Caveat & Gotchas of this database mod:
Quote from: Arantor on March 23, 2010, 06:09:41 PM
This thread does discuss multiple ways of doing it, but all require significant change or come with significant caveats and gotchas. There's no simple way that actually works cleanly without any side effects :(
Avatar Caveat:
Quote from: Arantor on March 05, 2010, 07:15:54 AM
Note that member avatars are shared if they use an external URL or pick from the gallery (since that's stored in the members table, along with their post count) but not if they upload their own (since that's stored in the attachments table)
Membergroup Caveat:
Quote from: Arantor on March 09, 2010, 10:12:29 AM
Yup, that's the idea but do see the caveats from me above, like about membergroups and so on.
Attachment Caveat:
Quote from: Arantor on March 27, 2010, 05:47:31 PM
Assuming you have two topic and two message tables, you'll be duplicating attachments unless you modify all the attachment handling code too (have fun with that)

Basically, an attachment is attached to a post by id. If you attach a file to message id 1000, the same attachment is visible in BOTH sides' message 1000.
Cookie Caveat:
Quote from: Mr. Doug on March 28, 2010, 08:26:56 AM
I've had no issues with cookies. Just make sure your cookies aren't named the same way. (keep them all different.)
Theme & Board Caveat:
Quote from: Mr. Doug on March 29, 2010, 08:38:17 AM
I found a caveat to a shared member DB. Make sure all the Themes on your boards are numbered the same way. If I make a change the default to one (and reset the members options), all 3 get the change pushed.
Custom Profile Caveat:
Quote from: Arantor on March 29, 2010, 08:41:20 AM
Note also that custom profile fields are also in that table...
Statistic Caveat:
Quote from: Mr. Doug on March 31, 2010, 08:36:06 AM
I ran into the same thing. If you run the "update statistics" maintenance, it fixes it. So now I just run that every few days until I can get around to writing a cron script that does it for me. Everything functions correctly, it just doesn't update the number of users in the bottom of the page..
Hope this will help. Happy testing! ;)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on July 15, 2014, 10:31:36 PM
I'm sure there's more than that, actually, and also quoting me saying "but see the above note" doesn't really help in this case.

But your own post indicates how many issues there are with this approach and why it's not a good idea...
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on July 16, 2014, 03:06:21 AM
Quote from: ahrasis on July 15, 2014, 10:11:57 PM
Indeed. All modifications have their own effects. Pleasant or unpleasant will depends on each mods.

But for learning and gaining knowledge, it is still useful, undoubtedly.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on July 16, 2014, 03:31:50 AM
I disagree. Bad knowledge is worse than no knowledge.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Hj Ahmad Rasyid Hj Ismail on July 16, 2014, 04:01:01 AM
It is not bad knowledge to learn. And IMO you know it. People do learn a long way, a short way, an easy way and a hard way. People also learn from errors and mistakes.

The mod gives ideas and ways to resolve or achieve something that someone need to accomplish. Whether it is important or not, it is another issue.

The idea itself has been developed into various another mods. This one is database with various forum installations sharing needed data. The other with single installation with same data but various forums.

It is undoubtedly useful to me and many others who discussed in this tips and tricks topic. It is even expandable and not only limited to SMF.

I can see your side of argument but it is not sound to me. Besides, we can always agree to disagree Captain Arantor. ;)
Title: Re: Share user database for 2 (or more) different forums.
Post by: Arantor on July 16, 2014, 04:03:22 AM
Oh, same as always, you see my point but declare it as not sound because you disagree with it.
Title: Re: Share user database for 2 (or more) different forums.
Post by: Alpay on March 11, 2015, 07:34:01 PM
If you are not sharing ( dbprefix_themes )

After being a  NEW member ( register.php)  for a while error field;

'{db_prefix}themes', smf_themes
Sources/Subs-Members.php

// Theme variables too?
   if (!empty($theme_vars))
   {
      $inserts = array();
      foreach ($theme_vars as $var => $val)
         $inserts[] = array($memberID, $var, $val);
      $smcFunc['db_insert']('insert',
         '{db_prefix}themes',
         array('id_member' => 'int', 'variable' => 'string-255', 'value' => 'string-65534'),
         $inserts,
         array('id_member', 'variable')
      );
   }