Users Sharing or Synchronisation between multiple sites

This forum is for general questions about extensions for Joomla! version 1.5.x.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
User avatar
headghogg
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Mon Feb 23, 2009 5:44 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by headghogg » Fri May 28, 2010 12:48 pm

Hi Guys

Not sure if this is hijacking and if so I apologise but my query is exactly like the title.

All I want to do is sync loads of different sites' users to one site but only one way. So I have 1 site with all users and lots of sites which have their own users.

Running a cron job at night for each site to update the central site maybe.

The central site will be a forum for everyone and i want to avoid people having to register twice.

Any help would be great.

Mark
Regards

Mark,
GoHost4U
http://www.gohost4webdesign

bonzo_bcn
Joomla! Apprentice
Joomla! Apprentice
Posts: 34
Joined: Sat Apr 14, 2007 3:37 pm
Contact:

Re: Users Sharing or Synchronisation between multiple sites

Post by bonzo_bcn » Mon Dec 20, 2010 9:23 am

I am testing this hack, but I'm facing a problem: there can't be two admins logged on the backend of the different sites at the same time.

If one admin logs in, the other site admin is logged out automatically.

I've set up the same $secret in both. Any ideas? At this time I'm only sharing VM tables.

EDITED: I shared the user tables of the first post and everything is working like charm.
http://www.arueda.com The first online road cycling magazine in spanish

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30809
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Users Sharing or Synchronisation between multiple sites

Post by Per Yngve Berg » Tue Dec 21, 2010 5:14 pm

Do both admins have their own users?

bonzo_bcn
Joomla! Apprentice
Joomla! Apprentice
Posts: 34
Joined: Sat Apr 14, 2007 3:37 pm
Contact:

Re: Users Sharing or Synchronisation between multiple sites

Post by bonzo_bcn » Tue Dec 21, 2010 5:29 pm

No, same users for both
http://www.arueda.com The first online road cycling magazine in spanish

User avatar
Per Yngve Berg
Joomla! Master
Joomla! Master
Posts: 30809
Joined: Mon Oct 27, 2008 9:27 pm
Location: Romerike, Norway

Re: Users Sharing or Synchronisation between multiple sites

Post by Per Yngve Berg » Tue Dec 21, 2010 5:33 pm

Create a separate user for each person.

SAGV
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Feb 18, 2011 11:19 am

Re: Users Sharing or Synchronisation between multiple sites

Post by SAGV » Fri Feb 18, 2011 11:27 am

Hallo, what can I do if command "Create View" isn't allowed on my server? I found that I just can write something like

Code: Select all

$sql = str_replace( '#__users', 'jos_users', $sql );
for tables in database.php but this code is for joomla 1.0. It doesn't work with 1.5.
What should I write for joomla 1.5?
Are there any other ways to share users and sessions?

SAGV
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Fri Feb 18, 2011 11:19 am

Re: Users Sharing or Synchronisation between multiple sites

Post by SAGV » Sun Feb 20, 2011 2:13 pm

Could anybody help me?

andmus
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Tue Feb 15, 2011 4:38 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by andmus » Fri May 27, 2011 8:03 am

Hi, thanks for the great tutorial! i would have a question: you said the this is not a good solution for two existing sites; i understood the i would lose users in one of the two databases but why one them could crash?
Thanks a lot,
Andrea

birnik
Joomla! Intern
Joomla! Intern
Posts: 50
Joined: Sun Jul 12, 2009 4:59 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by birnik » Tue May 31, 2011 6:10 am

Because you will be simply removing the whole tables in respect to users.
Birnik

Michel Kant
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Jun 01, 2011 10:03 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by Michel Kant » Wed Jun 01, 2011 10:31 pm

Okay, I have tested the rules (drop tables and created a view) in Joomla 1.6.3.

Respect for the inventor of this rule. :D
It works like a charm.

My new Joomla site very slow. I think because I use to many components.
My old site, still running, is on vbulletin and I want to migrate everything to Joomla.
So I purchased all components I used in vbulletin for Joomla. A blog, gallery, reviews, forums, real estate component, community builder etc.
The migration was going very fast and all content is transferred. Users are able to login so this was done well.
Only, the Joomla site is very, very slow.

I activate GZip and this saves some time. But still.
I read in the forums if there are too many components installed in Joomla, everything is slowing down.
My forum, this contains the most content, and is the most important thing on my site, was very slow.
So I created a fresh Joomla installation into a sub directory only for the forum. And now the forum is quite fast.
The rest of the site is still slow.
My hosting provider is on plesk. And plesk do not allow the same username for 2 different databases.
I created 2 subdirectories with test installations of Joomla 1.6. Both in same database, only different prefix. Jos_ and tst_
I drop the tables, and created view rules. And this works.

Now the question. If I split up my site in more Joomla installations, each with its own db-prefix and install some components in each installation. But all in the same database. will this improve the performance on the site? Or is it better to create more different databases with in mind that users can’t be shared.
Let me try to explain, the site is slow because too many components use to much recourses or is the mysql database to slow for all these components. Or are there too many files if there are too many components.

I hope someone can give me some wise answers.

Thank you

Michel Kant
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Jun 01, 2011 10:03 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by Michel Kant » Fri Jun 03, 2011 8:59 am

I merged the two different databases to one. Both with its own db-prefix.
And now it works perfect.
The Joomla with Kunena forum db-prefix forum_ and the other jos_
For the user tables, community builder tables and uddeim tables I created a view in the forum_ tables. They look at the jos_ database. And this works perfect. :D

Now I am trying to put symbolic links so I can store all images in one Joomla installation.

Still one question. I have create a forum tab in community builder.
When I clink on a user in the forums, and click on his forum tab, I can see the posts of this user.
But when I’m in the other installation, and click on a user, I see the forum tab. But when I click it there are no posts. The message is "there is no forum installed."
Well. The forum is installed in the other installation. Is there a way to view the forum posts?
tnx

andmus
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Tue Feb 15, 2011 4:38 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by andmus » Tue Jun 07, 2011 1:29 pm

Hi all,
if i have two existing sites, let's say site1 and site2, and i want to apply the hack above to share users and session, could i update user tables in site1 (copying users in site2) so that i wouldn't lose the users in site2 and after that apply the hack (drop tables in site2 and create views)? Could it works? Could i avoid any crash in this way?
Thanks,
Andrea

Michel Kant
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Jun 01, 2011 10:03 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by Michel Kant » Tue Jun 07, 2011 1:59 pm

Hi andmus,

Sharing users is easy with this rule. Only, at least one site has to be empty. So no content.
If each site contains content it is not possible.
Let me explain.
User (x) have written some articles on site a, and user (y) have written some articles on site b but both could have the same user id. Here the problem starts when transfering users from one to the other DB. In this case you should create a unique user id for each user, and connect the content.

Lots of work...

If one site is empty, and only contains users, you could modify the sql file and give users a unique user id before adding them to the other DB.

andmus
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Tue Feb 15, 2011 4:38 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by andmus » Tue Jun 07, 2011 4:08 pm

unfortunately i have already applied the hack to my 2 installations. but in site2 there were only two users. so now the 2 users are in both sites but they have different ids from the originals. if i understood i could connect the contents in site2 with the right ids. is it correct? on the other hand these two users haven't created contents in site1. is it possible to restore a stable configuration??
Thanks a lot.

Michel Kant
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Jun 01, 2011 10:03 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by Michel Kant » Tue Jun 07, 2011 4:42 pm

Do you have access to phpmyadmin?

Michel Kant
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Jun 01, 2011 10:03 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by Michel Kant » Tue Jun 07, 2011 5:01 pm

You could try to export the entire DB to a sql file, and edit the user id’s to the right one.
This can be done with notepad++. I use ms excel for editing databases.
if it’s lots of content, it could be lots of work. Only, you said there were only 2 users on one site, so if you can filter the tables, it is a find and replace job..
In phpmyadmin you also can export to csv file. This you can easily import into excel.

andmus
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Tue Feb 15, 2011 4:38 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by andmus » Wed Jun 08, 2011 8:03 am

OK! let's sum up:my two original users in site2 now have different id and contents in site2 could not be aligned with their authors. i have exported site2's database in a sql file. Now i should find and replace original user id with new user id in all tables. is it right? My problem now is how to replace the right values? for example if i have to replace user id=70 with user id=71 which tables do i have to consider? which search criteria should i adopt?
Thanks again.

Michel Kant
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Jun 01, 2011 10:03 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by Michel Kant » Wed Jun 08, 2011 12:57 pm

Basically every table that has a column user_id
If you installed lots of components, you will have many tables.
Only, not all tables contains user_id data.

Maybe you could start finding out what tables has a user_id column

If you want, you can send me the sql file and I will check.

andmus
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Tue Feb 15, 2011 4:38 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by andmus » Wed Jun 08, 2011 2:05 pm

Ok! i think i solved it! thanks again! but i have a doubt now: what does it happen if i delete an user (from joomla backend) who has written some contents? there would be some contents which reference non existing users. is it right? does joomla manage these circumstances? i think so and i could ignore contents written by users who are not in site1. is it wrong?
Thanks all,
Andrea

Michel Kant
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Jun 01, 2011 10:03 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by Michel Kant » Wed Jun 08, 2011 4:33 pm

Good question. I think the article still will be there. Only, there is no longer a user attached to it. I did not test this before.

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

Re: Users Sharing or Synchronisation between multiple sites

Post by thomas777 » Sat Sep 17, 2011 7:55 pm

Hi

I am trying to setup multiple Joomla sites with Joomla 1.7 and would like to setup user sync between the sites just as this thread indicates.

My question is does this work with Joomla 1.7.

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.

Thanks


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.

topcafirms
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Fri Jul 29, 2011 5:56 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by topcafirms » Sat Oct 08, 2011 7:34 pm

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.

I am purely a non-technical person without having any formal education of any coding...I was able to implement this on our website www.topcafirms.com and www.community.topcafirms.com & www.taks.topcafirms.com....... Thanks for gr8 help and clear instruction......... BUT I have one problem...it is not taking care as "single sign" on for all these three setup. What should be done to ensure that person loggedin in topcafirms.com reamined logged in community.topcafirms.com

Michel Kant
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Jun 01, 2011 10:03 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by Michel Kant » Sat Oct 08, 2011 9:37 pm

I had the same problem. Did you edit all config files? Secret value?

And, do you have cache enabled?

topcafirms
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Fri Jul 29, 2011 5:56 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by topcafirms » Sun Oct 09, 2011 4:49 am

i have done all the steps mentioned there...and user has successfully been syncing. Not sure about...cache...can u pls explain what should be status cache in all sites and where to change it. One more doubt, i have linked these website thru 'external link' in main menu..is there any other way to connect. Thnx in advance

Michel Kant
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Jun 01, 2011 10:03 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by Michel Kant » Sun Oct 09, 2011 7:39 am

I can imagine if sitecache is enabled on one site and disabled on other site, the user needs to login again if he switch sites.
I think there is no other way to link to the other site by using an external url link type. I do the same and I have no problems with that.
Are you using some components like Joomsocial or Communitybuilder?

topcafirms
Joomla! Fledgling
Joomla! Fledgling
Posts: 4
Joined: Fri Jul 29, 2011 5:56 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by topcafirms » Sun Oct 09, 2011 9:14 am

currently all my website cache is disabled...i had enabled on all website and tried checking this but same was not working...shld i keep yes for sometime and check...yes..community.topcafirms.com is on CB only

Michel Kant
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Jun 01, 2011 10:03 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by Michel Kant » Sun Oct 09, 2011 9:40 am

Maybe there is a problem using CB in one installation only.
My website is on CB also. And I have installed CB on both platforms.
And I did run the table view rule on CB sql tables also.

CB overrule the system login and system registration of Joomla. (if you selected this option).
I can imagine this could result in some problems.

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

Re: Users Sharing or Synchronisation between multiple sites

Post by thomas777 » Sun Oct 09, 2011 11:46 am

You may know more about this than me, but I think that Single Sign On using this method only works if the website is a sub directory websites. I am not sure about sub domains.

I am about to use the above method with CB also tables viewed aswell. I am hoping if all the websites have the CB login module that all should be ok.

Would this not work, if not what can be done.

Michel Kant
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Wed Jun 01, 2011 10:03 pm

Re: Users Sharing or Synchronisation between multiple sites

Post by Michel Kant » Sun Oct 09, 2011 4:00 pm

It works on subdomain also.
Just tested this.

User avatar
columbusgeek
Joomla! Apprentice
Joomla! Apprentice
Posts: 47
Joined: Mon Jun 04, 2007 1:53 pm
Location: columbus ohio
Contact:

Re: Users Sharing or Synchronisation between multiple sites

Post by columbusgeek » Wed Mar 21, 2012 2:48 am

This post is probably deader than a doornail, but it's the only relevant discussion about this method so here goes.

I setup this method and it, "mostly" works. If you register on the main site, all is well. If you register on the slave sites then you get a error.
"E_NOLOGIN_ACCESS"

Upon further snooping, I can't seem to pin down what the main site is doing that the slave sites are not doing. Even weirder, I use "theartofuser" extension and I can see the new user in there, but not in joomla's default user tool.

Totally stumped.


Locked

Return to “Extensions for Joomla! 1.5”