Users Sharing or Synchronisation between multiple Joomla sites

Hi..
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…

http://forum.joomla.org/viewtopic.php?p=2015114&sid=d5b6fe1ecd7a5fbda2417709d3d85818#p2015114


******   ***
I managed to make two sites work with common user base, I decided to share how it should be done step by step.

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).

Requirements:

  • 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:
Code:
DROP TABLE `jos_users`
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)

Code:
CREATE VIEW jos_users AS SELECT * FROM site1.jos_users
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.

Updating Joomla?
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.

Advertisements

PHP Developer..

Posted in Joomla 1.5, PHP
4 comments on “Users Sharing or Synchronisation between multiple Joomla sites
  1. Ravendra says:

    thanks a lot dear.

  2. Ore says:

    is ithis solution good for Joomla 3?

  3. Chelsea says:

    Excellent blog right here! Also your site quite a bit up fast!
    What host are you the use of? Can I get your associate hyperlink on your
    host? I want my website loaded up as fast as yours lol

  4. Jared says:

    Hello, we wrote an extension which will allow you to publish articles across multiple Joomla! sites. It is for Joomla 3.0 and higher. http://nychelpdesk.co/service/joomla-products/article-sharing-extension

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: