Version: 1.00, by robert_2004
Developer Last Online: Aug 2008
Version: 3.5.5
Rating:
Released: 10-31-2006
Last Update: 11-01-2006
Installs: 7
Uses Plugins
Code Changes Additional Files Is in Beta Stage
No support by the author.
This mod will allow you to combine multiple sites that you own and master, into the one set of files and database - easier to maintain, to update, to administer, and to master.
Even though this page is fairly long - there is a lot of info to set it up, but it's bloody easy to install, and easy to work with once installed.
What you can do:
- auto detect which site they have come to, and setup the right usergroup and style.
- run different styles on different sites.
- allow/deny different usergroups to different forums and version of site
- multiple forums with permissions set to individual sites
- multiple calendars with permissions set to individual sites
What you can't do:
- allow users to choose their own style (**coming soon**)
- can't run some plugins on some domains, and not on the others - all plugins must/will be active across the whole board.
- can't work if you have subdomains (at this point) - i dunno, it may - i just have 1 line which auto places 'www' on your domain.
- it is lacking an upgrade system to bring two forums together. I built this from the start - meaning my testing server was my original site, then i started a second test site, and started adding people to it - THERE IS NO MERGE SCRIPT *YET*. although, you might be able to use the vB to merge - CAN SOMEONE PLEASE VERIFIY / COMMENT ON THIS. (i.e. if you have 3000users/25,000posts in your main, and you want to bring 5000users/45,000posts from your 2nd site to combine them, we don't have anything on offer to reset the ID numbers, etc. possible the imPEX thinggy will resort all of that for you.)
---------- Important - My Current Setup:
i'm running vb 3.5 with vBa's CMPS.
i have it set up:
/public_html/index.php (cmps index)
/public_html/domains.php (this current mod)
/public_html/forum/ (all the forums' files)
USERGROUPS
With the usergroups - you are going to have to add the short_http into the start of the usergroup name - so please take this into account (as the system searches the short_http to grab the usergroup for the person viewing, to put them into that usergroup).
i set it up to not use the original 'registered users', but rather, each site has it's own 'registered users' usergroup.
The admin, super mod, banner member - i.e anything you want/think can work across ALL the sites can stay as one, the rest of the sites should have their own usergroups:
Code:
Please make sure that the custom usergroups are defined as below:
The number after the http_site (1st,2nd, etc) MUST correspond to the corresponding default vB usergroup id!
1.1st 1 - Unregistered / Not Logged In
1.1st 2 - Registered Users
1.1st 3 - Users Awaiting Email Confirmation
1.1st 5 - Super Moderators
1.1st 7 - Moderators
2.2nd 1 - Unregistered / Not Logged In
2.2nd 2 - Registered Users
2.2nd 3 - Users Awaiting Email Confirmation
2.2nd5 - Super Moderators
2.2nd 7 - Moderators
the first number: i put in just to order the domains (as i don't use '1st' and '2nd' on my testmachine - i use NORTH and WEST - but west was the first site, so i wanted it to be displayed first on the list)
the second number: '1st' and '2nd' are the http_site - the short hand name for each site - if you are running two computer games sites, one counter strike and the other world of warcraft, then 'CS' and 'WOW' are suitable.
the third number: corresponds to the original usergroup id with the same name.
---------
Example:
none at this point.
hacks and addons:
- adding events to multple calendars at once (coming soon)
- calendar custom fields working on multiple calendars
------------------------
[Temp area - installation steps]
cpanel -> add parked domains
mysql database change
domains.php
global.php
register.php
class_dm_user.php
functions.php
create styles
add plugin - domains.php
add plugin - force style
-------------------
FIRSTLY, backup YOUR database!!!
[Step 1 - Park your Domains ]
go into your cPanel or Plesk, or your hosting control system, and park your domains to your account - this will make all your domains, myFirstDomain.com and mySecondDomain.com all display the front page of your first initial site.
[Step 2 - mySQL Changes ]
none that i can remember / find at this point.
[Step 3 - /public_html/domains.php ]
create this file and insert the following:
PHP Code:
<?php
###### multiple site controller #########
################################
// https://vborg.vbsupport.ru/showthread.php?p=1108615#post1108615
/* THIS FILE IS THE DOMAIN CHECKER FOR EACH FILE AND PAGE
THAT IS SHOWN ON THE SITE.
IT WILL HELP SECURITY RISKS, AS IF A LINK CANNOT BE
MADE BETWEEN THE CURRENT HTTP_HOST, AND AN IF()
STATEMENT IN THIS FILE, IT WILL OUTPUT AN ERROR.
THIS ABOVE STATEMENT MAY CAUSE PROBLEMS IF YOU HAVE
SISTER-SITES, TRYING TO ACCESS
FILES AND/OR DATABASE
IF ANOTHER SITE IS ADDED TO THE FAMILY, YOU WILL NEED
TO CREATE THE IF() STATEMENT HERE TO ALLOW IT TO DISPLAY
CORRECTLY.
THIS FILE NEEDS TO BE CALLED VIA A PLUGIN
AND AS IN INCLUDED() ON EVERY NON-FORUM PAGE
TO CHANGE DOMAIN'S STYLE = adminCP ->Plugins -> Force Style for each Domain
// The Following will remove any problems by causing all your sites to begin with 'www'.
// Place WWW in front of all domains
if( strpos($_SERVER['HTTP_HOST'], 'www.') === false ) {
header("Location: http://www.$http_host$_SERVER[REQUEST_URI]");
}
if( preg_match('/MyFirstDomain.com/i', $http_host) ) { ##### My First Domain #####
// You can create any variables you want here:
$_SESSION['short_http'] = "1st"; // this is used in URL
$_SESSION['short_print'] = "1st"; // this is used for folder structure
$_SESSION['http_host'] = "MyFirstDomain.com";
$_SESSION['site_title'] = "My First Domain!!";
$_SESSION['site_home_title'] = "First Domain Forum and Home";
}
elseif( preg_match('/MySecondDomain.com/i', $http_host) ) { ##### My Second Domain #####
$_SESSION['short_http'] = "2nd";
$_SESSION['short_print'] = "2nd";
$_SESSION['http_host'] = "MySecondDomain.com";
$_SESSION['site_title'] = "My Second Domain!!!";
$_SESSION['site_home_title'] = "Second Domain Forum and Home";
}
/*
included an else clause here just to capture the unlikely
event that http_host is not passed. This can happen
with 1.0 useragents.
*/
else
{
header("upgradebrowser.html");
}
if (!function_exists(findCustomGroup)) {
function findCustomGroup($cid){
global $vbulletin;
$customIds = $vbulletin->db->query_read("SELECT usergroupid, title FROM " . TABLE_PREFIX . "usergroup");
while ($customId = $vbulletin->db->fetch_array($customIds)){
if (strpos($customId['title'],$cid)){
$cId = $customId['usergroupid'];
}
}
return $cId;
}
}
if (!function_exists(findAwaitingGroups)) {
function findAwaitingGroups(){
global $vbulletin;
$avug_array = array();
$avIds = $vbulletin->db->query_read(" SELECT usergroupid, title FROM " . TABLE_PREFIX . "usergroup");
while ($avId = $vbulletin->db->fetch_array($avIds)){
if (strpos($avId['title'],"Awaiting Email Confirmation")){
array_push($avug_array,$avId['usergroupid']);
}
}
return $avug_array;
}
}
?>
[Step 4 - global.php]
find [line 115]
PHP Code:
$vbphrase = init_language();
// set a default username
if ($vbulletin->userinfo['username'] == '')
{
$vbulletin->userinfo['username'] = $vbphrase['unregistered'];
}
below this, add
PHP Code:
// multiple site controller by Robert_2004
// https://vborg.vbsupport.ru/showthread.php?p=1108615#post1108615
require_once('../domains.php');
//let's set the appropriate site and forum titles as determined by the domains.php file.
//also used in providing the correct info in the appropriate emails (eg, activateaccount, welcomemail etc)
$vbulletin->options['hometitle'] = $_SESSION['site_home_title'];
$vbulletin->options['bbtitle'] = $_SESSION['site_title'];
$vbulletin->options['bburl'] = "http://www.".$_SESSION['http_host']."/forum";
$vbulletin->options['homeurl'] = "http://www.".$_SESSION['http_host'];
$vbulletin->options['http_host'] = $_SESSION['http_host'];
// set a default username
if ($vbulletin->userinfo['username'] == '')
{
//set the appropriate custom unregistered usergroup for all the guest accounts
$vbulletin->userinfo['username'] = $vbphrase['unregistered'];
$customUserGroup = $_SESSION['short_print']." ".$vbulletin->userinfo['usergroupid'];
$ncid = findCustomGroup($customUserGroup);
if (!empty($ncid)){
//print_r($vbulletin->userinfo);
//do not tamper with usergroupid just yet but rather utilise a
//customusergroupid field which will be used to set the appropriate
//forum permissions a little later on (function cache_permissions()).
$vbulletin->userinfo['usergroupid'] = $ncid;
}
}
[Step 5 - register.php]
find [line 265]
PHP Code:
// Set specified options
if (!empty($vbulletin->GPC['options']))
{
foreach ($vbulletin->GPC['options'] AS $optionname => $onoff)
{
$userdata->set_bitfield('options', $optionname, $onoff);
}
}
add, below:
PHP Code:
// multiple site controller by Robert_2004
// https://vborg.vbsupport.ru/showthread.php?p=1108615#post1108615
require_once('../domains.php');
find [line 285]
PHP Code:
else
{
$newusergroupid = 2;
}
below, add:
PHP Code:
// multiple site controller by Robert_2004
// https://vborg.vbsupport.ru/showthread.php?p=1108615#post1108615
//determine the correct unregistered custom usergroup
$customUserGroup = $_SESSION['short_print']." ".$newusergroupid;
$ncid = findCustomGroup($customUserGroup);
$newusergroupid = $ncid;
find:
PHP Code:
// sort out emails and usergroups
if ($vbulletin->options['verifyemail'])
{
$activateid = build_user_activation_id($userid, (($vbulletin->options['moderatenewmembers'] OR $vbulletin->GPC['coppauser']) ? 4 : 2), 0);
eval(fetch_email_phrases('activateaccount'));
vbmail($email, $subject, $message, true);
}
replace with
PHP Code:
// sort out emails and usergroups
if ($vbulletin->options['verifyemail'])
{
// multiple site controller by Robert_2004
// https://vborg.vbsupport.ru/showthread.php?p=1108615#post1108615
//with custom registered usergroups it's no longer sufficient to simply pass 4 or 2 to
//the build_user_activation_id() so let's be more dynamic.
//$activateid = build_user_activation_id($userid, (($vbulletin->options['moderatenewmembers'] OR $vbulletin->GPC['coppauser']) ? 4 : 2 ), 0);
//determine the appropriate registered usergroup to pass to build_user_activation_id()
$customRGroup = $_SESSION['short_print']." 2";
$rcid = findCustomGroup($customRGroup);
$activateid = build_user_activation_id($userid, (($vbulletin->options['moderatenewmembers'] OR $vbulletin->GPC['coppauser']) ? 4 : $rcid ), 0);
// multiple site controller by Robert_2004
// https://vborg.vbsupport.ru/showthread.php?p=1108615#post1108615
$customUserGroup = $_SESSION['short_print']." ".$newusergroupid;
$ncid = findCustomGroup($customUserGroup);
//grab all the relevant usergroupids for the various "Awaiting Validation" groups
$awug_array = findAwaitingGroups();
//if ($userinfo['usergroupid'] == 3 )
if ($userinfo['usergroupid'] == 3 || in_array($ncid,$awug_array))
find
PHP Code:
$users = $db->query_read("
SELECT user.userid, user.usergroupid, username, email, activationid, languageid
FROM " . TABLE_PREFIX . "user AS user
LEFT JOIN " . TABLE_PREFIX . "useractivation AS useractivation ON(user.userid = useractivation.userid AND type = 0)
WHERE email = '" . $db->escape_string($vbulletin->GPC['email']) . "'"
);
below, add:
PHP Code:
// multiple site controller by Robert_2004
// https://vborg.vbsupport.ru/showthread.php?p=1108615#post1108615
$customUserGroup = $_SESSION['short_print']." ".$newusergroupid;
$ncid = findCustomGroup($customUserGroup);
find
PHP Code:
while ($user = $db->fetch_array($users))
{
if ($user['usergroupid'] == 3)
{ // only do it if the user is in the correct usergroup
// make random number
if (empty($user['activationid']))
{ //none exists so create one
$user['activationid'] = build_user_activation_id($user['userid'], 2, 0);
}
else
{
$user['activationid'] = vbrand(0, 100000000);
replace with
PHP Code:
while ($user = $db->fetch_array($users))
{
// multiple site controller by Robert_2004
// https://vborg.vbsupport.ru/showthread.php?p=1108615#post1108615
//if ($user['usergroupid'] == 3)
$awug_array = findAwaitingGroups();
if ($user['usergroupid'] == 3 || in_array($ncid,$awug_array))
{ // only do it if the user is in the correct usergroup
// make random number
if (empty($user['activationid']))
{ //none exists so create one
// multiple site controller by Robert_2004
// https://vborg.vbsupport.ru/showthread.php?p=1108615#post1108615
//$user['activationid'] = build_user_activation_id($user['userid'], 2, 0);
if ($user['usergroupid'] == 3){
$ncid = $user['usergroupid'];
}
$user['activationid'] = build_user_activation_id($user['userid'], $ncid, 0);
// multiple site controller by Robert_2004
// https://vborg.vbsupport.ru/showthread.php?p=1108615#post1108615
'customusergroupid' =>array(TYPE_UINT, REQ_NO),
[Step 7 - functions.php]
find:
PHP Code:
$intperms = array();
$_PERMQUERY = array();
// set the usergroupid of the user's primary usergroup
$USERGROUPID = $user['usergroupid'];
replace with:
PHP Code:
$intperms = array();
$_PERMQUERY = array();
// multiple site controller by Robert_2004
// https://vborg.vbsupport.ru/showthread.php?p=1108615#post1108615
// if a user belongs to a custom Unregistered group then assign the custom usergroup id to foruminfo
// so that when they browse the forums we can restrict them accordingly.
if (isset($user['customusergroupid'])){
$USERGROUPID = $user['customusergroupid'];
}
else {
$USERGROUPID = $user['usergroupid'];
}
// set the usergroupid of the user's primary usergroup
//$USERGROUPID = $user['usergroupid'];
[Step 8 - styles]
either create child styles or import your styles
you'll figure out the best way to set them up
Set all your forums - thee are permissions to set for forums, usergroups, CMPS pages, etc
- remember, all heirarchy works on forums, and usergroups
- now for you to help.
Firstly, CLICK INSTALL >>>>>>>>>>>>>>>>>>>>>>>>>>
- If someone can turn this into a plugin, please go ahead
- if someone can see something to fix - please write it
- if you can help with updating/improving some code - please do it
- this mod is open for anyone and everyone, if you want to do something with it and release it - you are more than welcome to - PM ME so i can put a link & description to your version (i.e if you make a lite version, or a to in a different direction with this mod).
- if you want any features or updates, please write so on this forum - if it's good enough for me, i'll get it done - otherwise we'll see.
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
No, it does not create more sites under one license, but if you have multiple licenses with diffrent sites on parts of server, it lets you manage them all in 1.