-
- 2 Posts
Hi,
I’m considering using Modx for a new project and I have some questions about the site context features in Revo. What I want to do is share specific tables between sites using either a prefix or even a separate DB.
For example:
sitename_users
shared_users
sitename_settings
shared_settings
Is something like this possible in modx revo? If so, can someone point me in the correct direction; to the relevant wiki, docs, API docs etc. If its not possible with existing features, is it possible to extend or over-ride them and achieve this? I’m a skilled PHP coder so what I’m primarily looking for is just
#1 Confirmation that this is achievable
#2 A point in the correct direction
thanks.
-
- 24,544 Posts
If I’m understanding you correctly, I don’t think you’ll need to do that. The MODx tables for those things are already shared between contexts.
Access Permissions give users access to specific contexts (which lets them see the resources in those contexts) but the resources are all in one table.
With multiple contexts, there is still only one user table -- in fact, adding a context doesn’t add any new tables.
Context settings override system settings, but if no context setting has been set, the system setting applies.
User settings override both context settings and system settings but, again, if they don’t exist the other settings are used.
I think the only reason for doing something like you describe would be if there were so many resources in each context that performance became an issue. Even then, I don’t think what you’re suggesting would be the way to go.
-
- 2 Posts
Thanks for the replies, much appreciated. I’ve begun working with modx revo; as I get handle on the site contexts I’ll be sure to help contribute some documentation. Modx revo is a significant rEvolution(pun intended) from evolution and I’m loving it so far.
You can’t share tables across separate MODx configurations, where each configuration has a database and a single manager. The idea with multi-context configuration, where all tables are shared, is you simply give the appropriate permissions to load the Context( s ) that is/are relevant to a specific User Group when they login to the manager.
-
- 18 Posts
I'm working on building some basic client websites under the umbrella of my own domain, and have chosen to do this using separate contexts for each website, and I have their domain names pointed to the sub-domains of my umbrella site where each context has a separate sub-domain...
If I wanted to selectively choose on a per-context basis, to have compartmentalized tables for example for users (each context sharing everything else in the db except for users where they would have their own table), is that achievable?
The main reason for my question is that I want to be able to map out a workflow to extract a client's website from the umbrella site should a client wish to manage their website on their own or move to another company. If I could compartmentalize certain tables within the database that would make extracting a website from the umbrella much easier...
-
- 24,544 Posts
I don't think that's possible without *extensive* hacking of of the MODX core (not recommended), which would be overwritten whenever you upgrade MODX. The mechanisms that handle users (e.g., to create, edit, delete) have little or no concept of contexts. Outside the permission system, the only MODX objects that have a context_key field are modResource and its descendants (modDocument, modSymLink, modWeblink, and modStaticResource).
I think the closest you can come to what you want will be to manage users with User Groups and permissions.
It's not all that difficult to export a subgroup of users (and their user profiles) from the DB, and then import them at another site (assuming that the MODX versions match exactly). Subgroups of Resources can also be exported and imported fairly easily if you don't need the TV values. If you do need the TVs, it's still doable, just a little more complex.