Using this tip, you will be able to share a user database for multiple phpBB forums with common banlist, disallow, groups, private messages, ranks, sessions, smilies, themes and users.
Step 1 Install a new phpBB forum with any prefix (i.e. using the default phpbb_).
Step 2 Remove the prefixes from the following tables:
banlist
disallow
groups
privmsgs
ranks
sessions
sessions_keys
smilies
styles_theme
user_group
users
wordsYou can do this easily with phpMyAdmin:
- Code: Select all
ALTER TABLE phpbb_banlist RENAME banlist;
ALTER TABLE phpbb_disallow RENAME disallow;
ALTER TABLE phpbb_groups RENAME groups;
ALTER TABLE phpbb_privmsgs RENAME privmsgs;
ALTER TABLE phpbb_ranks RENAME ranks;
ALTER TABLE phpbb_sessions RENAME sessions;
ALTER TABLE phpbb_sessions_keys RENAME sessions_keys;
ALTER TABLE phpbb_smilies RENAME smilies;
ALTER TABLE phpbb_styles_theme RENAME styles_theme;
ALTER TABLE phpbb_user_group RENAME user_group;
ALTER TABLE phpbb_users RENAME users;
ALTER TABLE phpbb_words RENAME words;
Step 3 Install a second copy of phpBB in the
same database, but this time, you should use a new prefix (i.e. sitename_).
Step 4 Open the file
includes/constants.php for both installed phpBB forums. Remove every
$table_prefix in the following lines:
- Code: Select all
// Table names
define('BANLIST_TABLE', $table_prefix.'banlist');
define('DISALLOW_TABLE', $table_prefix.'disallow');
define('GROUPS_TABLE', $table_prefix.'groups');
define('PRIVMSGS_TABLE', $table_prefix.'privmsgs');
define('RANKS_TABLE', $table_prefix.'ranks');
define('SESSIONS_TABLE', $table_prefix.'sessions');
define('SESSIONS_KEYS_TABLE', $table_prefix.'sessions_keys');
define('SMILIES_TABLE', $table_prefix.'smilies');
define('STYLES_THEME_TABLE', $table_prefix.'styles_theme');
define('USER_GROUP_TABLE', $table_prefix.'user_group');
define('USERS_TABLE', $table_prefix.'users');
define('WORDS_TABLE', $table_prefix.'words');
to become something like this:
- Code: Select all
// Table names
define('BANLIST_TABLE', 'banlist');
define('DISALLOW_TABLE', 'disallow');
define('GROUPS_TABLE', 'groups');
define('PRIVMSGS_TABLE', 'privmsgs');
define('RANKS_TABLE', 'ranks');
define('SESSIONS_TABLE', 'sessions');
define('SESSIONS_KEYS_TABLE', 'sessions_keys');
define('SMILIES_TABLE', 'smilies');
define('STYLES_THEME_TABLE', 'styles_theme');
define('USER_GROUP_TABLE', 'user_group');
define('USERS_TABLE', 'users');
define('WORDS_TABLE', 'words');
Step5 Login to the Administrator Control Panel (ACP) for both phpBB forums. Set up the cookie settings (General tab -> server configuration -> Cookie settings) and make sure that the cookie settings are the same for both forums.
Step6 Test it out. Register a new user account on the first phpBB forum and then go to the second forum to see if the account exist there. If it does, all should be working.
Step7 (optional) Delete the unused tables of the second installs (for each additional site, repeat this step): If you want to you can now go back and remove any redundant tables. These will be the ones listed in step two that were made from the second install. However, it is probably easier to simply leave them there. Make sure you
do not remove any tables without a prefix because they are the common tables for all forums.
To do this easily, open phpMyAdmin and execute this code:
- Code: Select all
DROP TABLE sitename_banlist;
DROP TABLE sitename_disallow;
DROP TABLE sitename_groups;
DROP TABLE sitename_privmsgs;
DROP TABLE sitename_ranks;
DROP TABLE sitename_sessions;
DROP TABLE sitename_sessions_keys;
DROP TABLE sitename_smilies;
DROP TABLE sitename_styles_theme;
DROP TABLE sitename_user_group;
DROP TABLE sitename_users;
DROP TABLE sitename_words;
Note: Since the forums are not sharing the same configuration, you can give each different settings and can set the default theme for each board to a unique one and override the users preference (since users info is shared the templates should be as well). Also you will only have to upload one avatar directory and not two if you set the links to the avatar directory correctly, saving some valuable space.