We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38142
    • 91 Posts
    The situation: A site is intended to have many clients access the manager to edit their own resources (a different resource for each client, but with all those resources using the same template with a series of TVs to upload/edit images). Ideally, clients should only see their own folder of images when they click the TV on their resource to edit an image.

    Question: Is the only way to limit access to media folders when clicking the TV to assign a new media source for the TV for each client? That would mean having a unique resource template with a unique TV tied to a unique media source for each client, would it not? 100 clients => 100 TVs for 100 templates. Is it not possible to use a single template/TV combination for all clients (with the TV pointing to a parent media folder) and somehow limit the client to seeing only the subfolder that has been created for them when they click the TV?

    Seems impossible, but am I missing something?

    Thanks.

    This question has been answered by sottwell. See the first response.

    • discuss.answer
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      That's what the MIGX snippet 'migxresourcemediapath' is useful for. Use the snippet in place of the path in the Media Source path and URL:
      [[migxResourceMediaPath? &pathTpl=`assets/businesses/{id}/`]]

      The snippet allows you to use the resource ID, or several other resource fields. It also has a property to have the snippet create the path if it doesn't exist.

      This way you can use one TV to handle all of your client pages.

      You don't need to use any other feature of MIGX to use this snippet, it just comes as part of the MIGX package.

        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
        • 38142
        • 91 Posts
        Thank you, Susan. Looks like you have pointed me in the right direction. Getting there will be a challenge. But I am hopeful.

        This tutorial seems to detail the steps (or some of them):

        http://rtfm.modx.com/extras/revo/migx/migx.tutorials/migx.use-resource-specific-mediasource-and-multifile-uploader
          • 4172
          • 5,888 Posts
          you really just need to put this snippet-tag (or another custom one) into the path and url of your mediasource to get a mediasource with dynamic pathes.
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 38142
            • 91 Posts
            Thank you, Bruno. I realised that the tutorial I linked to above was doing too much (I don't need the multi-image uploader). I am trying out the snippet and see how it creates a folder using the ID number of the resource controlling the page on which the photos will appear. That is a very useful function. Thank you again.