Share user tables with multiple joomla 1.5 installations

Your code modifications and patches you want to share with others.
Locked
ben91082
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Fri Oct 17, 2008 9:32 am

Share user tables with multiple joomla 1.5 installations

Post by ben91082 » Sat Jun 06, 2009 8:26 am

Hi,

I am trying to share common tables between multiple installations of joomla sharing the same database with different table prefixes. I have added the following to libraries/joomla/database/database.php

Code: Select all

$common_tables = array('#__users'=>'share_users',
'#__core_acl_aro'=>'share_core_acl_aro',
'#__core_acl_aro_groups'=>'share_core_acl_aro_groups',
'#__core_acl_aro_sections'=>'share_core_acl_aro_sections',
'#__core_acl_groups_aro_map'=>'share_core_acl_groups_aro_map');
$search = array_keys($common_tables);
$replace = array_values($common_tables);
array_push($search,$prefix);
array_push($replace,$this->_table_prefix);
$literal .= str_replace( $search , $replace , substr( $sql, $startPos, $j - $startPos ) );
When I register a new user, the user record is successfully added to the shared user table. However the corresponding records aren't added to the shared _core_acl_aro and core_acl_groups_aro_map tables, but get added to the non-shared tables instead. It seems that there might be somewhere else in the code where "#__" is being replaced by the usual table prefix that I have missed.

This has been covered before by ircmaxell here: http://forum.joomla.org/viewtopic.php?p=541052, however this is quite an old thread so I'm wondering if this approach is no longer valid for Joomla 1.5. Has anyone managed to successfully share tables in this way?

Thanks,

Ben

User avatar
MrRoyce
Joomla! Ace
Joomla! Ace
Posts: 1176
Joined: Mon Oct 09, 2006 9:52 pm
Location: Tampuh Floriduh - The jewels of America's wang.
Contact:

Re: Share user tables with multiple joomla 1.5 installations

Post by MrRoyce » Fri Jul 10, 2009 1:44 pm

Just curious, why would you use different table prefixes? I have a 1.0 application that has 5 J! implementations using 1 set of tables.

I haven't tried this in 1.5 but I'm not sure what the advantage of different prefixes is?

vitass
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sat Dec 12, 2009 10:37 am

Re: Share user tables with multiple joomla 1.5 installations

Post by vitass » Sat Dec 12, 2009 10:43 am

Hi!
It seems that the code is all right! what part of database.php i have to insert this code in?

kryshak
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Mon Aug 24, 2009 9:59 am

Re: Share user tables with multiple joomla 1.5 installations

Post by kryshak » Mon Apr 12, 2010 5:39 pm

Hey, i want to try this method.
Is this work?

kruti
Joomla! Apprentice
Joomla! Apprentice
Posts: 6
Joined: Wed Apr 28, 2010 7:33 am

Re: Share user tables with multiple joomla 1.5 installations

Post by kruti » Tue Jun 22, 2010 1:33 pm

Hello,
Even I need this functionality to work in Joomla 1.5.15. Can anyone tell me weather it is working or not? Also, tell me where should we keep this code in libraries/joomla/database/database.php ?

Thanks in advanced.

kryshak
Joomla! Apprentice
Joomla! Apprentice
Posts: 12
Joined: Mon Aug 24, 2009 9:59 am

Re: Share user tables with multiple joomla 1.5 installations

Post by kryshak » Tue Jun 22, 2010 3:10 pm

No, it's not working.
I did it in other way. I just change table prefixes in SOBI2 and it works great.

ben91082
Joomla! Apprentice
Joomla! Apprentice
Posts: 14
Joined: Fri Oct 17, 2008 9:32 am

Re: Share user tables with multiple joomla 1.5 installations

Post by ben91082 » Mon Jun 28, 2010 9:54 am

Hi,

I'm afraid I never quite got this working. It's a long time since I attempted so I can't quite remember what was wrong.

Sorry I can't be more helpful and I hope you manage to find a working solution


Locked

Return to “Core Hacks and Patches”