We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4097
    • 15 Posts
    I’ve created several pages that list the contents of specified directories that users have access to upload files to i.e.:

    Marketing Materials --> Displays contents of /assets/Marketing --> Accessible by user "jdoe"
    Sales Materials --> Displays contents of /assets/Sales --> Accessible by user "jsmith"

    I want to create an area on another page that displays the most recent uploads to these directories.

    ~~ Recent Additions ~~
    Marketing Materials - Marketing Paper.pdf
    Sales Materials - Sales Document.pdf

    Any ideas on how to accomplish this?

      • 4097
      • 15 Posts
      I edited this to be more specific in hope of finding an answer.
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        You can use the FileDownload snippet with the &userSort and &groupByDirectory parameters.
        http://www.muddydogpaws.com/development/filedownload/parameters.html
        As far as limiting the number, I’m not sure how that would work; there doesn’t seem to be a limit parameter. Maybe PHx would be useful here?

        I think it could be hacked easily enough (line 166, immediately after the array is run through the custom_sort() function) to truncate the array to the number of items you want to show. This might be a good addition to the parameter list as well, &fileLimit or something.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org