Shared user database for multiple forums, same server
Mod Version: 1.00, by CyberRanger
This modification is in the archives.
vB Version: 3.0.9 |
Rating: (0 vote - 0 average) |
Installs: 15 |
Released: 12 Oct 2005 |
Last Update: Never |
Downloads: 1 |
Not Supported
Code Changes
|
For version 3.5x+, please see Multiple Forums using a single user table
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 http://www.vbulletin.com/forum/showthread.php?p=971124#post971124 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.
Download
No files for download.
|