Joomla 1.7 User Sync between multiple sites

General questions relating to Joomla! 2.5. Note: All 1.6 and 1.7 releases have reached end of life and should be updated to 2.5. There are other boards for more specific help on Joomla! features and extensions.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Locked
thomas777
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Sep 07, 2011 1:01 am

Joomla 1.7 User Sync between multiple sites

Post by thomas777 » Sat Sep 17, 2011 10:11 pm

Hi
i asked this question in a 1.5 thread by replying to a topic there, not realizing that it was 1.5.

I am trying to have multiple websites use the same users between sites, I know there are a couple extension to do this but the ones that I find for 1.7 do more than I want. I just want it so if a user is registered on one of my sites they don't need to create a new account on the second one. Also ensuring they have the same name and password between them.

I found a thread in the 1.5 forum that seems to address this showing how to modify the data base using views but as far as I can tell the 1.7 data base may be different.

So here is what I found. and my question.

I followed the instructions but Joomla 1.7 only has 2 of the tables listed in the instructions. Unless I am missing something. The ones that it has is, jos_users and jos_session .

I seem to be able to login on one site and be logged in the other, automatically after doing the views onto the first 2 tables, which is good.

But I want to make sure that everything is correct since the other 6 tables can't be done. Do I need to do more but with different tables.

I don't need this for community builder or anything, just plain Joomla user sync. I wan't users registered on one site to be registered on the other site.

The instructions that I found for Joomla 1.5 to get this working are
birnik wrote:tboheeren asked me, how I done it. I can't send personal messages yet, therefore I reply here. Hope he will read it.

As 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: Select all

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: Select all

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.

 
User avatar
bud1960
Joomla! Apprentice
Joomla! Apprentice
Posts: 44
Joined: Mon Oct 19, 2009 11:43 pm
Location: NW Ohio
Contact:

Re: Joomla 1.7 User Sync between multiple sites

Post by bud1960 » Sat Sep 17, 2011 10:28 pm

Hi Thomas,

I don't know if this helps you at all, but starting with 1.6, they modified the ACL extensively to allow multiple groups per user. There should be some tables dealing with groups and mapping that you might need to look at:

Code: Select all

*_usergroups
*_users
*_user_profiles
*_user_usergroup_map
HTH,
Bud

baldnut
Joomla! Apprentice
Joomla! Apprentice
Posts: 18
Joined: Mon Jul 17, 2006 11:43 am

Re: Joomla 1.7 User Sync between multiple sites

Post by baldnut » Sat Sep 17, 2011 11:52 pm

are all sites on the same server? if so just write a php script to run on cron every 10 minutes or 60 minutes to copy the users to the other sites, basically update the other tables with the same data held in the main jos_users table I dont think you can manipulate the sessions the same they would still need to login to the other sites but at least the account exists already for them

thomas777
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Sep 07, 2011 1:01 am

Re: Joomla 1.7 User Sync between multiple sites

Post by thomas777 » Sun Sep 18, 2011 11:30 am

Thanks for the info.

I might just try creating views for the other tables you mention and see what happens. Thanks for that. The site is not live at all and this is the time to get something like this working.

At this point using views it has real time user sync between both sites, including live sessions. I am logged in one and automatically logged in the other.

What I am concerned about is the other 6 tables listed for Joomla 1.5 instructions but not in Joomla 1.7. I believe these relate to permissions and things to make sure a user has the correct ACL and group settings and such between sites.

I am new to Joomla so I apologize if I am not clear.

Has anyone done something like this on 1.7? If so how.

 

Locked

Return to “General Questions/New to Joomla! 2.5”