my client have two websites.. he want user of one website can access the other site too..
I have searched on google .. I found something interesting & useful…
What is the solution?
- Allows two or more Joomla! sites to have one and the same user base and sessions.
- It could be used for other stuff (i.e. banners, sections etc.) however this is not subject of this guide. We will review only users and sessions.
What the solution is not?
- It is not a bridge, a component, module, plugin or something like this. This is a solution on database level.
- If you want to share components, articles etc. it is much more complicated, however not impossible. But this is not something we will review here.
- It is not recommended to use this solution for two already existing sites, as at least one of them will either crash, or you will at least lose its user base.
- The users in the two (or more) sites will have one and the same access rights (i.e. super admin in one will be super admin in the others as well and so on, you cannot set different rights for the different sites).
- MySQL 5
- PHP 5
- Joomla! 1.5
- The sites should share one and the same database server and the database user should have access rights to all databases in use.
BEFORE DOING ANYTHING TO YOUR EXISTING WEB SITES, MAKE A BACKUP, AS YOU MAY LOSE DATA.
Step by step:
- Install Joomla! on localhost/site1 (or domain.com – doesn’t matter) with database name site1.
- Install second Joomla! on localhost/site2 (or any domain) with database name site2 – it is important that the database user for both sites is one and the same.
- Open the configuration.php files of both installations and copy the secret value ($secret = ‘somesymbolshere’;) from the configuration of site1 to the configuration to site2. So both installations should have one and the same secret key in their configuration. If you want to add even more sites, the other sites should also have the same key for secret.
- Open phpMyAdmin of the database of site2 and execute one by one (each row is one execution) the following:
DROP TABLE `jos_session`
DROP TABLE `jos_stats_agents`
DROP TABLE `jos_core_acl_aro`
DROP TABLE `jos_core_acl_aro_groups`
DROP TABLE `jos_core_acl_aro_map`
DROP TABLE `jos_core_acl_sections`
DROP TABLE `jos_core_acl_groups_aro_map`
Now run the following SQL queries in the same database (if necessary replace site1 with the corresponding database name used by site1)
CREATE VIEW jos_session AS SELECT * FROM site1.jos_session
CREATE VIEW jos_stats_agents AS SELECT * FROM site1.jos_stats_agents
CREATE VIEW jos_core_acl_aro AS SELECT * FROM site1.jos_core_acl_aro
CREATE VIEW jos_core_acl_aro_groups AS SELECT * FROM site1.jos_core_acl_aro_groups
CREATE VIEW jos_core_acl_aro_map AS SELECT * FROM site1.jos_core_acl_aro_map
CREATE VIEW jos_core_acl_aro_sections AS SELECT * FROM site1.jos_core_acl_aro_sections
CREATE VIEW jos_core_acl_groups_aro_map AS SELECT * FROM site1.jos_core_acl_groups_aro_map
And that is all. Both sites will now have one and the same users and sessions. Adding more sites is easy, just follow the instructions here for site2 database and configuration file.
If you have existing site and you want the new one you are setting up to have all of the users of the old one, you can do it, by just imaging that your old site is site1 in this example and follow the instructions post installation.
If you have two existing sites – THIS IS NOT THE RIGHT SOLUTION FOR YOU.
As for versions 1.5 – there is no problem. Upgrade both of your installations without any worries.
As for version 1.6 – it is hard to say yet, as it is not stable enough.
Hope you find it useful. If you have any questions, ask in that thread.