We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 11413
    • 203 Posts
    I want to create a plugin that will set the template of the created documents automatically according to where thay are placed in the document hierarchy.

    I created my new plugin and now I want to know a few things :

    * To do the change automatically, what is the event I have to catch? If i understood correctly, i have to use OnDocFormSave... right? If not, wich event will do the job ?

    * I know how to retrieve the name of the template of a document, but how do I change it and save it to the database? Do I have to use an ID or the template’s name?

    This is how i’m gonna do if my other idea can’t work and because it’s the fastest way of doing things.

    My other problem : The website is for an online newspaper. I want to have only one other user registered to my website. The real person behind this user is gonna change often (one time per 6 month or less or one time per year if lucky) and most of the time it won’t be someone who will be really good with computers. He will know how to use MS Word, but even that I can’t be sure. Here is what I want :

    I want to keep the manager hidden from that user so he won’t be messing around with the configuration and screw things up and I won’t be forced to lock everything. I want to display a form only to web users where the user will enter :


    • the title of the publication
    • the introduction text for the issue (so a RTF editor)

    When the user submit this thing, i want my module to create a new sub-directory in a known directory (always the same) and to add the introduction text to it and to set its template.

    The thing is that i’m a little bit noob at writing MODx plugin (not in PHP, but modx’s documentation seems to be far from complete, so I need your help guys!). So I don’t want the thing done for me, but I want directions to do exactly that... not a work around as I already got that was : ’use permissions and the manager’.

    Thanks a BIG LOT in advance!

    Blaise Bernier

    P.S.: I’m really willing to contribute at writing MODx’s reference, so if you help, I’m gonna start documenting events and writing a few tutorials. Thanks again!
      Blaise Bernier

      www.medialdesign.com - Solutions for small business, hosting, design and more!
      • 18397
      • 3,250 Posts
      Modules and Plugins are (mostly) for backend use.

      What you are describing is a fairly straitforward modification to the NewsPublisher snippet.

        • 18397
        • 3,250 Posts
        Remember, if you don’t want your user to see the manager, and want to have frontend webuser protected publishing capabilities, your only option is the NewsPublisher snippet. smiley

        What you are describing is a fairly straitforward modification to the NewsPublisher snippet.