This thread will detail how to have a single login for multiple forums. It makes the following assumptions:
A valid vbulletin license exists for each install
All forums will be on the same server
You already have one forum operational AND that forum uses a BLANK $tableprefix!
One database will contain all the tables
This thread is a follow-up from this discussion over at vbulletin.com. Thanks to Brains for some pointers!
Here are the steps:
Copy your forum directories to a parallel directory (for example copy /www/forums to /www/new_forums)
In /includes/config.php, change $tableprefix (line 91) to a new prefix [for example $tableprefix = 'new_';]
Run the vb install from the new directory (/www/new_forums/install/install.php)
During the install, be sure NOT to empty the tables. If you have any doubt about what this means, stop NOW! If you empty the tables, you will lose all of your existing data from a prior install!
Download the files from these directories to your PC: /new_forums, /new_forums/admincp, /new_forums/archive, /new_forums/includes, /new_forums/modcp, /new_forums/subscriptions
We are now going to make global changes to the files in the folders (and subfolders) above. I used Dreamweaver's "edit-find and replace" function with "find in" set to "Entire Current Local Site". We are basically going to remove the "TABLE_PREFIX" from any code dealing with the user. (Note - if you are comfortable with unix command, you could do these changes from the command line on the server.)
Run the following find and replace operations:
Find [" . TABLE_PREFIX . "user] (find what's inside the brackets). Replace with [?.?user] This should find 562 instances of user, usergroup, userfield, and usertextfield
Find [" . TABLE_PREFIX . "strikes] (find what's inside the brackets). Replace with [?.?strikes] This should find 5 instances of strikes
Find [" . TABLE_PREFIX . "pm] (find what's inside the brackets). Replace with [?.?pm] This should find 61 instances of pm, pmtext, pmtextid, and pmreceipt.
Upload these directories back to the server.
We now need to do a little fine tuning
In /includes/functions.php: on line 1171 remove the table_prefix before $idname.
In /includes/adminfunctions: modify print_choser_row (line 1161)to check for $tableid of user, usergroups
PHP Code:
if ($tableid == "user" OR $tableid == "usergroup") {
$result = $DB_site->query("SELECT title, $tableid FROM "."$tablename$wherecondition ORDER BY title");
} else {
$result = $DB_site->query("SELECT title, $tableid FROM " . TABLE_PREFIX . "$tablename$wherecondition ORDER BY title"); // existing code
}
In /includes/adminfunctions_user.php around line 116 (construct_style_chooser)
PHP Code:
$tableid = $tablename . "id";
if ($tablename == "user" OR $tablename == "usergroupid") {
$result = $DB_site->query("
SELECT title, $tableid FROM "."$tablename WHERE userselect = 1
ORDER BY title
");
} else {
// existing code
$result = $DB_site->query("
SELECT title, $tableid FROM " . TABLE_PREFIX . "$tablename WHERE userselect = 1
ORDER BY title
");
}
Done! Both forums are now accessed by the same user table! PM's are unified across forums as is the user count.
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
I keep saying I intend to update this but between RL, helping with ecDownloads, finishing up a new extension I'm about to release ... not enough time in the day!
I am getting the following errors in the admincp once I try to change a users permission.
Code:
Warning: Invalid argument supplied for foreach() in /admincp/user.php on line 905
Warning: Invalid argument supplied for foreach() in /admincp/user.php on line 924
Peter - thanks for explaining some of the above. Yes, this is for vb3.0.x. The concept is the same for vb 3.5.x but you will need to make changes, especially for #8. I keep saying I intend to update this but between RL, helping with ecDownloads, finishing up a new extension I'm about to release ... not enough time in the day!
Sure,
One thing I can say that is not working as described in your how to, would be the Member Count. For some reason, after 2-3 days now, New Forum #2 is still only showing 1 user.... however is there something I can run to sync this up? You quickly mentioned something about waiting for Cron to refresh. Where exactly do I run this to refresh? and wouldn't it have done it already?
Please help me, after applying this hack I can't login in the admincp!
Everything else seems working fine, but when I login in admincp I return to login form, maybe a session problem?
Westy: Any luck working out how do this for 3.5.x? I really need to have two installs of vB sharing the same user database and so far this is the nearest thing I've found. Cheers for your help so far.
I don't think you guys realize... that this is a general hack that is not just for vb 3.. it can be used in ANY vb version, it's the "guts" behind the hack/info that defines how or what should be done.
Keep in mind, even with the proper info above for the "set" version he is writing this hack for, still does not work out of the box. Well, it does kinda, if you use the exact version the author is using. However, even the instructions I had to work with, I was missing some strikes table and a few others.. I just skipped them. No harm done.
The only problem I've had with this hack is very minor --
When you have a Running board, with say 1000 members or posts and then begin this hack to a fresh board, the new board statistics do not reflect the old board.
ie: 1 Thread, 1 Post, 1 Members
Then I made a tweak to at least show who's online (I made old board and the new board look at the same `sessions` table, so now if there are 5 users on the old board, there is 5 users + how many users are on the new board. That works.
The problem we have is the "new fresh board" member count. It's only showing 1 member - Admin. However, now I've got to find a way to refresh this stats.. if possible.. to reflect what both boards show. I think it's some serilized data somewhere in the db. I'll figure it out soon enough.