MyBB Community Forums

Full Version: Using same MyBB DB for 2 sites but with different headers
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all,

I'm trying to figure out something but I haven't been able to do so yet and was wondering if anyone can HELP!

I've got two websites - one is directed towards GBP customers and the other to USD customers. Since the hosting service is the same and questions/answers the same, it makes sense to maintain only one forum so I'm sharing the MyBB database between them.

So both sites are on the same server, both accounts have full installs of MyBB, but one account is conencting to the other account's MySQL. Stuff like Main Site Name, Main URL, Contact Email is fine to be configured separately as they can be maintained in each accounts "settings.php" file. Even the logos are different as the script references a local logo.gif file which can separately be maintained in each account.

However, editing the header is the problem, as the header code is integrated within MyBB, so if I want to enter custom information under the logo, normally this would be done under the Header template, but the problem is that this info is held within the MySQL db and is would be shared for both sites.

So basically what want to do, is to put my GBP plans under my logo on .co.uk site, and USD plans under my logo on .com site whilst sharing the same MyBB forum.

Any advice/help/ideas much appreciated.

Regards,
Suhail.
You can change the prefix for each install like mybb_ and mybb2_ so that they can be in the same database. If you are talking about stuff like sharing the same user_tables that's more complex and will require heavy modification to work.
You should be able to do this with a plugin as well.

Essentially create a new theme for your other site. You need to fetch the ID numbers of each theme (view the source of the theme management page in the Admin CP and find the tid= lines and match them up which each theme.

Download the attached file and open it up in a text editor. At the top you should find a section you need to configure. Enter each of the forum URLs you have similarly to how I have - they must match the board URLs configured in each of your different settings files. Change the integer at the end of the line to match the theme ID you want that URL to show.

Upload the file to your inc/plugins directory and go to the plugin manager in the Admin CP and enable it. With any luck you should be seeing two different themes - and you can assign a different template set to each theme where you can customise different things.

(Note, I haven't tested this)
Thanks Chris, I'm going to try this now.
Just an update - the script you provided Chris didn't work, at least not out of the box. But thank you for knocking it up nevertheless.

I ended up implementing the following simple solution which can be seen on my two sites:

http://www.hostfor99p.co.uk
http://www.hostfor99cents.com

1.) Main DB created under hostfor99p.co.uk account.
2.) hostfor99cents.com shares the main DB via MySQL settings in /inc/config.php
3.) Create index.html file on both sites.
4.) Insert MyBB board into index.html pages via "inline" html code.
5.) Whilst forums are now shared, some customisation is not, such as forum name, forum URL etc - you can see this is the case by comparing both sites.
6.) Remove logo in header template and instead use different logs in index.html files

The result is what I now have! I'm quite happy with this setup - unless anyone can point out any serious oversights.

Hope this helps anyone trying to do the same thing!

Regards,
Suhail.