I'm going to throw in some info about what I've done on my site in case it helps.
My situation is not the same as yours but in many ways is similar. My site uses one domain - not multiple domains - but is essentially a main site with subsites.
I wanted a site where members could log in (once) to the main site and then go to their 'local' subsite. I wanted some info to be specific to the local site and some to be shared.
Members log into the main site and then use links to get to the subsites (only the main site and one subsite at the moment, though potentially this could reach 36 subsites - the site has only been up a week).
For example, each 'site' has it's own news, events, and other modules but share forums, contact us, docs, etc.
The subsites live in their own subdirectory of the site e.g.
Main site -
www.mainsite.com
Subsite one -
www.mainsite.com/subsite1
This is an oversimplification, but basically it works by adding a new table prefix in config.php. I call it $local_prefix. I then go through all the code and replace $prefix by $local_prefix where I want tables to be specific to their subsite.
The main site config.php has $prefix and $local_prefix values which are identical.
Each subsite uses the same $prefix (and $user_prefix) as the main site but has a different $local_prefix.
When deciding which modules/tables it's possible to share you have to be very careful. For example, the Polls/Stories/Topics are linked so don't expect to (easily) be able to have shared polls but individual news and vice versa.
Also, I decided to have the forums module shared because things like Members List, Private Messages, User Groups are closely linked to it and these have to be shared. No separate forum module on my site.
I build the database tables for each subsite manually. Using phpmyadmin to copy the table structure with the new prefix. Of course it would be possible to build an installation routine for each subsite but this is still very much a work in progress.
The code is basically a copy of the mainsite in each subdirectory. This means there is a lot of redundant code but space is not a major consideration for me - I was more concerned about the number of tables and general mess on the database. Also, on a busy site the size of the database is likely to be the major issue, spacewise.
I also use a couple of other variables in the config.php - $subsite, which holds the name of the subsite and $ismainsite, which is set to show if this is the main site or not.
These variables mean the code knows which subsite it is in.
Problems that spring to mind are:
This involves a lot of code changes. Whilst the code changes are simple this gives plenty of room to introduce errors, typos etc. Easy to forget to set the $local_prefix global in a function. If you haven't changed a $prefix to $local_prefix you will get some very strange results.
Also, when updating to the next release you have to do it all again...
Allowing a member to log in at one subsite and out of another caused problems. You could log out of the mainsite and find you were still logged in at the subssite. No doubt a cookie problem, I couldn't resolve this without forcing log on/off from the mainsite. I used my $ismainsite global to control this, directing members to the main site log in/out if they were in a subsite. Exascerbating this problem is the fact that I have changed the user cookie so that it is a session cookie, for security reasons. Many of my members use web bars so I force them to log in each time they visit (session cookies die when the browser is closed down - my members forget to log off).
Well, that's my bit thrown into the ring. This is from memory so I'm sure I've missed out a few important facts. I don't pretend that this is the best way to do it but it meets my needs. Like many things, this solution was arrived at in a hurry and I'm sure there are better ways to do it.
This sort of conversion is not for the fainthearted or those unfamiliar with PHP and SQL. You will introduce bugs and have to sort them out. However, it does show what is possible. My site is running very happily at the moment (
famous last words).
Maybe a disclaimer on behalf of CPG Nuke is in order here as I have the 'debugger' reference next to my name. I should make it clear that this way of doing things has
not bee\n recommended/advised by CPG Nuke and it is quite possible I have introduced errors/security issues by doing it. If anything goes wrong I have only myself to blame - and if you copy me, you only have
yourself to blame.
Having said that, I hope this bit of info helps. I'd be very interested to hear other members solutions to this and similar issues.