PHP Bulletin Board Home
News About Home
Features of phpBB Test drive phpBB Downloads Support for phpBB The phpBB Community Styles for customising phpBB 3rd party modifications to phpBB

Support Home | Knowledge Base Home | Submit Article | Search Articles | Browse Articles
 Multiple Boards, 1 User Database 
Description: How to set up your forums to share one user database.
Author: Matthijs
Date: Tue Oct 29, 2002 3:54 pm
Type: Tutorial
Keywords: user, database, share, sharing, userbase, userdatabase, multiple, boards
Category: Improvements
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:
 
ALTER TABLE master_users RENAME users;
ALTER TABLE master_user_group RENAME user_group;
ALTER TABLE master_groups RENAME groups;
ALTER TABLE master_sessions RENAME sessions;


4) Optionally delete the unused tables of the SLAVE installs (for each slave repeat this step, note that future upgrade scripts might complain about missing tables):
Code:
 
DROP TABLE slave1_users;
DROP TABLE slave1_user_group;
DROP TABLE slave1_groups;
DROP TABLE slave1_sessions;


5) Change for all installs (MASTER and SLAVES) the entries in includes/constants.php to (remove the $table_prefix):
Code:

define('GROUPS_TABLE', 'groups');
define('USER_GROUP_TABLE', 'user_group');
define('USERS_TABLE', 'users');
define('SESSIONS_TABLE', 'sessions');


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. Because the sessions table is shared too, people logged in on one forum are also logged in on another forum. You'll need to make sure the cookie settings in the admin panel are consistent for all forums. 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). Also, the cookie path must not be restricted, but instead changed to the shared part of it (f.i. www.mydomain.com/forums/master and www.mydomain.com/forums/slave1 will have '/forums/' or '/' as the cookie path).

Username: Password:
News | Features | Demo | Downloads | Support | Community | Styles | Mods | Links | Merchandise | About | Home
 © Copyright 2002 The phpBB Group.