[Tutorial] Multiple Boards, 1 User Database

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Matthijs
Former Team Member
Posts: 1031
Joined: Sat Dec 08, 2001 4:27 pm
Location: The Netherlands
Contact:

[Tutorial] Multiple Boards, 1 User Database

Post by Matthijs » Thu Apr 11, 2002 10:50 am

New link to the Knowledge Base

So, you'd like your forums to share the user database.
There have been a lot of posts about this topic before, but I think (judging from the amount of questions we still get) a tutorial is a good idea.

Here it goes. The process is pretty easy.

1) You'll have to install all boards into seperate directories and preferrably in the same database, using different table prefixes (I will use master, slave1, slave2, ..., slaveN).

2) Designate one board as the MASTER install, this one will act as the user-database for all other forums. The rest will be called SLAVES from now.

3) For consistency, rename the MASTERS shared tables to not use the prefix (using a tool like phpMyAdmin f.i.):

Code: Select all

ALTER TABLE master_users RENAME users;
ALTER TABLE master_user_group RENAME user_group;
ALTER TABLE master_groups RENAME groups;
4) Delete the unused tables of the SLAVE installs (for each slave repeat this step):

Code: Select all

DROP TABLE slave1_users;
DROP TABLE slave1_user_group;
DROP TABLE slave1_groups;
5) Change for all installs (MASTER and SLAVES) the entries in includes/constants.php to (remove the $table_prefix):

Code: Select all

define('GROUPS_TABLE', 'groups');
define('USER_GROUP_TABLE', 'user_group');
define('USERS_TABLE', 'users');
6) You're done. All your forums are now using the same user database. Banning and configuration options can be set for each forum seperately. If you want people logged in on one forum be logged in in another forum, all you need to do is make sure the cookie settings in the admin panel are the same. All forums have to use the same domain, but they can differ in subdomains (f.i. forum1.mydomain.com will have mydomain.com as the domain for cookies).


Keywords: user database share sharing userbase userdatabase multiple board boards
Last edited by Matthijs on Thu Apr 11, 2002 10:55 am, edited 1 time in total.
phpBB Converter Team Member
Developer of the vBulletin 2.x.x -> phpBB 2.0.x Converter
See Matthijs.net for more info

User avatar
dhn
Former Team Member
Posts: 4999
Joined: Wed Jul 04, 2001 8:10 am
Location: Internet
Name: Dominik Dröscher
Contact:

Post by dhn » Thu Apr 11, 2002 10:53 am

I will make this sticky, we need a turtorial forum :)

The_Vader
Registered User
Posts: 57
Joined: Thu Mar 14, 2002 4:34 pm
Location: Ft. Bragg, NC
Contact:

Post by The_Vader » Fri Apr 12, 2002 4:07 pm

yes I've thought of this before but!!! what if you want to give each forum it's own admin and moderators without the other board admins/mods having control in the sister boards!

Am I asking this correctly hope so....lol

Or am I just missing something all together!

Thx for the tutorial I could've used this way back in 1.X.X . It was needed, and yes their is a need for a tuturial forum.
"Never argue with an idiot. They drag you down to their level, then beat you with experience."

My Homepage My Forums

Matthijs
Former Team Member
Posts: 1031
Joined: Sat Dec 08, 2001 4:27 pm
Location: The Netherlands
Contact:

Post by Matthijs » Fri Apr 12, 2002 7:10 pm

For admins, there is no option presently.
For moderators, you can just make (hidden) groups of moderators for each board and give the group special rights on the board they are moderator of.

Without lots of modifications, I see no way you can make each board have different Usergroups.
phpBB Converter Team Member
Developer of the vBulletin 2.x.x -> phpBB 2.0.x Converter
See Matthijs.net for more info

WyyndLD
Registered User
Posts: 6
Joined: Fri Apr 05, 2002 8:07 pm

Post by WyyndLD » Fri Apr 12, 2002 9:23 pm

I've been toying around with this some... and for me.. it was apparent that I wanted users on one forum to be able to send private messages to a user in another forum -- I just excluded the table prefix on the 2 priv message tables.. so they are part of the master forum as well. Now my users can send messages back and forth from which ever forum they're logged in to.

Not sure if there is a reason why this would be a bad practice. So far it seems to work pretty well.

User avatar
Black Fluffy Lion
Former Team Member
Posts: 6057
Joined: Sat Dec 15, 2001 11:37 am

Post by Black Fluffy Lion » Sat Apr 13, 2002 7:58 am

good tutorial :D

smigit
Registered User
Posts: 381
Joined: Fri Nov 30, 2001 2:54 am
Location: Australia
Contact:

Post by smigit » Sat Apr 13, 2002 10:30 am

dhn wrote: I will make this sticky, we need a turtorial forum :)

if u mean an example them www.eboards.tk is using that system, not exactly the same but basically the same in its idea cept with sum extra tables being sharred.

smigit
Registered User
Posts: 381
Joined: Fri Nov 30, 2001 2:54 am
Location: Australia
Contact:

Re: [Tutorial] Multiple Boards, 1 User Database

Post by smigit » Sat Apr 13, 2002 10:33 am

Matthijs wrote: Delete the unused tables of the SLAVE installs (for each slave repeat this step
[/size]


i wold advise ppl 2 keep em for upgrade purposes, if the upgrade script cant find a table it may not work in future upgrade scripts.unless it just makes a new table... but there is the possibility it wont upgrade anything so yeh.

smigit
Registered User
Posts: 381
Joined: Fri Nov 30, 2001 2:54 am
Location: Australia
Contact:

Post by smigit » Sun Apr 14, 2002 2:14 am

one more question (sorry it wont let me edit my previous post so i need a new 1)

when making backups whats the best way to go bout it? if i use the backup button then ud have 2 do it 4 each forum and sum data would keep getting repeated. would it be better to use phpmyadmin to do it?

desean84
Registered User
Posts: 205
Joined: Thu Jan 03, 2002 8:53 am
Location: Singapore

Post by desean84 » Sun Apr 14, 2002 2:59 am

i use mysqldump to backup my db. then i'll set a cron job to perform the task every midnight, using phpmailer to send the backup to my email (my db is small so it's alright) :wink:

cmc
Registered User
Posts: 3
Joined: Fri Sep 28, 2001 6:59 pm
Location: Atlanta, GA

Post by cmc » Wed Apr 17, 2002 4:43 pm

Actually, if you don't want shared groups just don't rename/adjust the 2 group tables listed above. My forums are using a single shared users table, but they maintain separate groups tables since I could think of no reason to share them.

Of course, it would be nicer to have "global" users and groups while being able to maintain local users/groups ala EZboard, but that's a whole nuther problem. :)

Nice idea on the private messages, though. I'd not considered that. I'll be running along to implement that right now! :)

sara_dippity
Registered User
Posts: 45
Joined: Fri Apr 05, 2002 10:35 am
Location: Oklahoma, "Land of Dull"

Post by sara_dippity » Wed Apr 17, 2002 7:28 pm

Excuse my newb and simple question: If I want 2 boards, and I only have one database availible on my host, but I do not want to share users (compleately different subjects, no reason to), do I need to rename any tables? I know it was said you didn't have to for groups, but would it create a conflict within my database if I didn't?

Matthijs
Former Team Member
Posts: 1031
Joined: Sat Dec 08, 2001 4:27 pm
Location: The Netherlands
Contact:

Post by Matthijs » Wed Apr 17, 2002 10:19 pm

If you want two totally different forums in one database, just use two different table prefixes. There is no need to rename anything or edit any files.
phpBB Converter Team Member
Developer of the vBulletin 2.x.x -> phpBB 2.0.x Converter
See Matthijs.net for more info

Nivisec
Registered User
Posts: 78
Joined: Wed Jan 16, 2002 2:24 pm

Post by Nivisec » Thu Apr 18, 2002 1:51 am

A quick "take this into account" thing. There are un-foreseen side effects of a user dbase merger, I've done this type of thing before and ran into one in particular that wasn't rather pleasant.

If you are doing this, do not let users choose styles unless you manually set both boards to include the distinct style IDs. If the users choose a style on one board and the other board doesn't contain that exact style ID, the page will not load.

sara_dippity
Registered User
Posts: 45
Joined: Fri Apr 05, 2002 10:35 am
Location: Oklahoma, "Land of Dull"

Post by sara_dippity » Thu Apr 18, 2002 4:21 am

Thanks!

Locked

Return to “2.0.x Support Forum”