MyBB Community Forums

Full Version: two boards with same users
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Anythings possible. Theres just not anyone atm willing to do it.
Suppose I create 2 MyBB's in one database.

Each having a different prefix (bb1_ and bb2_)

Now, for the relevant tables (users, groups, etc) I remove the prefix, and let both BB1 and BB2 use the same users and groups tables.

Should that work? Of course, in the scripts I would have to find each and every place these tables are beeing read / updated. That's the main challenge: which tables should be "shared tables" and where in the scripts should the mods be made? It would be nice if there was an arry with table names and prefixes, so that you have 1 place to alter the relevant tablenames into the "shared" tablenames (meaning: remove the prefix).

You might think this would work won't it?
Hi there,

I have got it to work, 2 mybbs forums sharing 1 users and 1 usergroups table. I don't know if it's the most elegant solution, but it works just fine. Here's what I've done:

First of all: this is probably NOT going to work if both MyBB's are on seperate subdomains. I have used subdirectories on one domain instead. Also, I use one database, each MyBB having a different prefix. That way you don't have to alter the MyBB DB connection code. As I said: probably not the most elegant solution...

Starting point was 2 MyBB forums. MyBB1 and MyBB2. I wanted MyBB1 to be the "main" BB for a few matters (especially Users and Usergroups).

Create both MyBB's in one database, using different prefixes (mybb1_ and mybb2_ for example)

In MyBB2 we want to link some tables to MyBB1:

1. In "init.php", find:
define("TABLE_PREFIX", $config['table_prefix']);
right below that line, add:
define("TABLE_PREFIX2", $config['table_prefix2']);
2. In config.php, find:
$config['table_prefix'] = 'mybb2_';
right below that line add:
$config['table_prefix2'] = 'mybb1_';
3. Find in all *.php files (no closing quote!):
TABLE_PREFIX."users 
replace these by
TABLE_PREFIX2."users
4. repeat step 3, now using a single quote instead of a double quote!
5. repeat step 3 and 4 for table: usergroups

Now you can safely remove table mybb2_users and mybb2_usergroups, since they are no longer used: both MyBB's now share the same users and usergroups table.

In this setup both boards can still have their own templates, themes, forums, etc. And you can still have a completely different forum-structure in both mybb's. Just alter the forum acces in both mybb's for one single usergroup to your liking.

It seems to work just fine for me. I created a new group, and both BB's show the group. I log into one BB, and I am also logged into the other BB.

Of course, this is not all. I am currently investigating the other tables. I have come up with a list of tables that should probably also be linked.

Maybe one of the MyBB developers can help here? Which tables should also be linked? I think the "master" Mybb should also take care of all private mail too, for example.

sessions - > don't know, really
adminsessions -> don't know either

These should probably be linked too:
adminoptions
adminlog
groupleaders
moderatorlog
moderators
mailqueue
banned
awaitingactivation
privatemessages
joinrequests

Please let me know if I'm on the right track here... I used a freshly installed set of MyBB's, with no additional plugins installed yet.
Pages: 1 2