I need to create documents and add/remove users to/from user groups. Is there any way to do this using Modx API?
I am reluctant to directly manipulate Modx tables on the database, simply because it’s against the principle of encapsulation of Modx functionality and may break my code in future releases of Modx. After all, Modx already performs these functions and I only need to tap into that functionality.
I appreciate any help on this.
Thanks for the link. It’s exactly what I was looking for. I’ll certainly give it a try.
-
MODX Staff
- 10,725 Posts
Current releases of MODx are primarily written in procedural code and reuse of the management code is not possible. MODx Revolution was reconstructed from the ground up over the past three years and will feature a complete, reusable OO API for the core features and data structures.
Please be aware that the CakeMODx code at that link is not an official MODx API and was shared by a 3rd party that has as of yet chosen not to participate in the core team development process of MODx. We obviously cannot support or encourage use of this API. There are several others like this available for specific tasks, as well, but you’ll have to use those at your own risk. What is more important is that you isolate any code in your custom components for working with core data into functions which you can later modify to use an official API or another one you may come up with yourself.
BTW, even with procedural code it shouldn’t take too much time to add a few methods to Document Parser class and expose some of the functionality that are provided by internal procedures. I am sure it will help a lot of Modx developers while they are waiting for the release of Revolution.