We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28000 ☆ A M B ☆
    • 397 Posts
    I have a question regarding sanitizing folder names when a manager user creates a folder. I have the extra filetranslit in place, but this does not control folder names. Does anyone have a tip here?

    Thanks!
      Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
      • 4172
      • 5,888 Posts
      think, it should be possible to rename the created folder with a plugin for OnFileManagerDirCreate
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 28000 ☆ A M B ☆
        • 397 Posts
        No one has a tip other than writing a new plugin for this?
          Benjamin Davis: American web designer living in Munich, Germany and a MODX Ambassador. I am also co-founder of SEDA.digital, a MODX Agency.
          • 3749
          • 24,544 Posts
          I was going to suggest connecting the plugin you have to OnFileManagerDirCreate too and borrow code from the upload section, but OnFileManagerDirCreate makes no use of it's return value.

          You could put in a feature request for adding an OnBeforeFileManagerDirCreate event. It should be a pretty simple addition to the file mentioned above.

          Another possibility would be to attach your existing plugin to the OnFileManagerDirCreate event too and add code to rename the directory using $source->renameContainer().

          It would look something like this (untested):

          /* code to change the value of the $name variable here, based on the code in the current plugin */
          $source->renameContainer($directory, $name);


          If you want to paste the code of the filetranslit plugin here, we might be able to suggest the proper rewrite.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting