简体   繁体   中英

Joomla plugin to override table prefix

Overview: I have a single Joomla website that have various copies of the database tables all in the same database, but with different table prefixes.

Depending on which user is accessing the site, i need to alter which joomla table prefix is used in order to display the relevant tables.

This has to be site wide.

Problem: with a core code hack i can alter the prefix as needed, but would prefer this as a plugin.

With the plugin i can get the prefix, using $db->getPrefix(), and i can set an immediate instance of the connection using $db = JDatabaseDriver::getInstance( $option ). But this is not site wide and is overwritten by the standard $db = JFactory::getDbo().

So i need a system plugin that will repalce every instance of a table prefix as it is run.

Any ideas?

Sorry but if you install a new component or module you have many problem to synchronize this changes on all DB. I think the best for you is to redirect each user to his real site (many joomla file with many db). Otherwise you can create a personal component and read table prefix of that user and display only date that you want, in this way just duplicate the tables you need and not all the joomla structure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM