After a successfull install of this modification your sites will share User, PM, and sesson data.
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
One database will contain all the tables
A valid vbulletin license exists for each install
Follow these steps
1.) Download your new copy of VB that contains a seperate license key
2.) Go to /includes/config.php.new rename the file to config.php and make necessary changes to the file. See VB Directions. Make sure this code has a different setting than the master site for table prefix.
PHP Code:
// ****** TABLE PREFIX ******
// Prefix that your vBulletin tables have in the database.
$config['Database']['tableprefix'] = '';
3.) Run the vb install from the new directory (/www/new_forums/install/install.php)
4.) 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!
5.) Download all files and directories to your PC from the new install location.
6.) You will need a tool to do a mass Search and replace on all files. I use WildEdit. Here is what you will do using a tool like Wild Edit.
Search for [" . TABLE_PREFIX . "user] Replace with [" . "vb3_user] where "vb3_" is the prefix to your master site. 110 Files modified 599 Total changes made
Search for [" . TABLE_PREFIX . "strikes] Replace with [" . "vb3_strikes] where "vb3_" is the prefix to your master site 4 Files modified 8 Total changes made
Search for [" . TABLE_PREFIX . "pm] Replace with [" . "vb3_pm] where "vb3_" is the prefix to your master site 16 Files modified 77 Total changes made
Search for [" . TABLE_PREFIX . "session] Replace with [" . "vb3_session] where "vb3_" is the prefix to your master site 20 Files modified 31 Total changes made
Now to modify some of the code.
In /include/class_dm.php
Search for:
PHP Code:
function fetch_insert_sql($tableprefix, $table)
{
Add below change vb3_ to your master site prefix:
PHP Code:
if ($table == "vb3_pmtext")
{
$sql = "INSERT INTO {$table}\r\n\t(" . implode(', ', array_keys($this->$table)) .
")\r\nVALUES\r\n\t(";
}
else
Go to /include/class_dm_pm.php
Search for:
PHP Code:
var $table = 'pmtext';
Replace with making vb3_ the prefix to your master site:
Replace with where vb3_ is the prefix to your master site:
PHP Code:
DELETE FROM ?.?vb3_session
Search for:
PHP Code:
INSERT INTO " . TABLE_PREFIX . "passwordhistory (userid, password, passworddate)
Replace with where vb3_ is the prefix to your master site:
PHP Code:
INSERT INTO " . "vb3_passwordhistory (userid, password, passworddate)
Search for:
PHP Code:
UPDATE " . TABLE_PREFIX . "session SET
Replace with where vb3_ is the prefix to your master site:
PHP Code:
UPDATE ?.?vb3_session SET
That is all the code modification.
The only other item I did is remove a couple cron jobs.
Go into Scheduled tasks then to Scheduled Task Manager
Delete the following CRON jobs from the Slave Site
User Promotions*
Birthdays
Activation Reminder Email
This will eliminate members getting emails from the primary and secondary sites
*not sure if this will duplicate efforts between primary and secondary sites I have it running on both sites still waiting to see if it causes any issues.
Please post here if you have any problems and questions I will try my best to keep up with everyone to help you through this. Once you get the code done the first time you can just do a mass search and replace on your license code and you can be up and running in minutes with a new site.
This is my first major modification so I hope I posted this all correct, again Thanks to Westpointer for his original work without his post this would not have been possible.
Thanks
UPDATE:
Please make this changes it will allow you to make changes to usergroups in the subscription section and when editing a user.
admincp/adminfunctions.php
Search for
PHP Code:
$result = $vbulletin->db->query_read("SELECT title, $tableid FROM " . TABLE_PREFIX . "$tablename$wherecondition ORDER BY title");
Replace with
PHP Code:
if ($tablename == "usergroup")
{
$result = $vbulletin->db->query_read("SELECT title, $tableid FROM " . "vb3_$tablename$wherecondition ORDER BY title");
}
else
{
$result = $vbulletin->db->query_read("SELECT title, $tableid FROM " . TABLE_PREFIX . "$tablename$wherecondition ORDER BY title");
}
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.