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

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

Previous topic - Next topic

Cal-Look

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!

Goosemoose

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

Anguz

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.
Cristián Lávaque http://cristianlavaque.com


Goosemoose

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

HoTmetal

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

Anguz

Cristián Lávaque http://cristianlavaque.com

jazz

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!

Anguz

You could, you'd have to set the whole second forum to allow only that group access.
Cristián Lávaque http://cristianlavaque.com

Kazona

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

[Unknown]

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]

nanoarray

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.


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?

[Unknown]

So they don't show up in the members table?  Do they show up in the old/other members table?

-[Unknown]

nanoarray

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?

nanoarray

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?


nanoarray

How do you combine the total post and total topic in both forums, so that both forums show the same numbers?

raedzaro

thanks but How share two forums with two differrent languages?

Jan

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?  ::)

[Unknown]


Goosemoose

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.

Advertisement: