0

I have 2 sites, let's call them site1 and site2. They're setup as subdomains such as:

site1.domain.com and site2.domain.com

They're both running Joomla 3.9.24 and I have created a view on site2 database to get their user details from the site1 database.

I have renamed the tables on site2 db:

RENAME TABLE `site2_users` TO `site2_bak_users`;
RENAME TABLE `site2_session` TO `site2_bak_session`;
RENAME TABLE `site2_usergroups` TO `site2_bak_usergroups`;
RENAME TABLE `site2_user_notes` TO `site2_bak_user_notes`;
RENAME TABLE `site2_user_profiles` TO `site2_bak_user_profiles`;
RENAME TABLE `site2_user_usergroup_map` TO `site2_bak_user_usergroup_map`;
RENAME TABLE `site2_viewlevels` TO `site2_bak_viewlevels`;

and then created a view on site2 database to get the user details from site1 database:

CREATE VIEW `site2_users` AS SELECT * FROM `SITE1_DATABASE`.`site1_users`;
CREATE VIEW `site2_session` AS SELECT * FROM `SITE1_DATABASE`.`site1_session`;
CREATE VIEW `site2_usergroups` AS SELECT * FROM `SITE1_DATABASE`.`site1_usergroups`;
CREATE VIEW `site2_user_notes` AS SELECT * FROM `SITE1_DATABASE`.`site1_user_notes`;
CREATE VIEW `site2_user_profiles` AS SELECT * FROM `SITE1_DATABASE`.`site1_user_profiles`;
CREATE VIEW `site2_user_usergroup_map` AS SELECT * FROM `SITE1_DATABASE`.`site1_user_usergroup_map`;
CREATE VIEW `site2_viewlevels` AS SELECT * FROM `SITE1_DATABASE`.`site1_viewlevels`;

This is working great.

Site2 is running Kunena and the users are showing in the users data in Kunena.

I was assuming that if a user is logged into site1, then they should be logged into site2 automatically?

But if I log into site1 and then load site2, I need to log in again (using the same log-in info)

I need the user session to be the same for both sites. Any ideas?

1
  • 1
    This is really a too broad/general question to answer. Of course if you just copy user credentials from one database to another it will not mean that you log users into another website. Your direction about user sessions on different websites is a good direction on this subject. It looks like a lot of work, a lot of study, to accomplish what you are up to.
    – Zollie
    Jan 13 at 19:48
0

You can write little plugin, hook in on onUserLogin and onUserLogout to exchange user login/logout between these sites. And login user programmatically.

https://docs.joomla.org/Plugin/Events

1
  • Welcome to JSE and thank you for contributing. Please take our tour. I don't know if this answer is specific enough for Rusty, but then again, the question was a bit broad as well-- so I suppose this type of answer is somewhat fitting.
    – mickmackusa
    Jan 16 at 23:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.