syncing CB users between 2 sites

12 years 8 months ago #174408 by giuse3
syncing CB users between 2 sites was created by giuse3
Hi, I have 2 sites with CB (Joomla 1.5, CB 1.4). I need the two sites to share the users so that they can register on one and login on both. I think it's a common problem.
To do that I created DB views on the second DB to see DB tables of the first site (like "create view jos_users as select * from site1.jos_users;") but I think it's not the best solution, CB config tools throws me errors (of course) and I got problems in trying to upgrade from 1.4 to 1.7.
Is there a better way to do that? Using one of the incubator plugins?
Probably just the sessions should not be synchronized, since they refer to specific data on the site, so not to be shared.
Thanks a lot

Giuse

Please Log in to join the conversation.

12 years 8 months ago #174486 by krileon
Replied by krileon on topic Re: syncing CB users between 2 sites
All you need is incubator project CB Queries. From there you'd perform an external database query after the registration trigger and create the user. You'll need to ensure ACL is covered and the core features of the user are covered. Below would be an appropriate query for CB Queries.
INSERT INTO `#__users` ( `name`, `username`, `email`, `password`, `usertype`, `block`, `sendEmail`, `gid`, `registerDate`, `lastvisitDate`, `activation`, `params` ) VALUES ( '[name]', '[username]', '[email]', '[cb:userdata field="password" /]', '[usertype]', 0, 0, [gid], '[registerDate]', '[lastvisitDate]', '', '\n' );
INSERT INTO `#__core_acl_aro` ( `section_value`, `value`, `order_value`, `name`, `hidden` ) VALUES ( 'users', ( SELECT `id` FROM `#__users` WHERE `username` = '[username]' ), 0, '[name]', 0 );
INSERT INTO `#__core_acl_groups_aro_map` ( `group_id`, `section_value`, `aro_id` ) VALUES ( [gid], '', ( SELECT `id` FROM `#__core_acl_aro` WHERE `value` = ( SELECT `id` FROM `#__users` WHERE `username` = '[username]' ) ) );

Please note the above is just an example and may need changes. Please ensure you've tested it thoroughly before deploying to a live site. Beyond this I can't help you with synchronizing tables as CB has no support for multiple DBs, sorry.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.145 seconds

Facebook Twitter LinkedIn