We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22108
    • 39 Posts
    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.
      • 14267
      • 113 Posts
      These functions might work for you. I was about to try them out myself.

      http://modxcms.com/forums/index.php?topic=35663.0

        • 22108
        • 39 Posts
        Thanks for the link. It’s exactly what I was looking for. I’ll certainly give it a try.
          • 22303 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.
            • 22108
            • 39 Posts
            Quote from: OpenGeek at May 16, 2009, 02:16 PM

            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.
            Thanks for the tip. Since the site is live, I cannot take any chances that can potentially jeopardize the smooth operation of the site.

            I can’t wait for the Revolution (no pun intended grin). I’ll try to do as you suggested and create a temporary fix myself.
              • 22108
              • 39 Posts
              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.
                • 22303 MODX Staff
                • 10,725 Posts
                Quote from: OldGuru at May 20, 2009, 06:53 PM

                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.
                Adding functions to the document parser class is definitely not the proper solution here as that is adding unnecessary code that would burden the load of every page in a MODx site. We have given a lot of thought to this, and do not want to introduce additional "official" methods for this until Evo (1.0) and Revo (2.0) baseline releases are established. Once this milestone is passed, we can consider approaches to close the gap for Evo.