We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6531
    • 154 Posts
    I need to create a page which presents a lengthy legal agreement to the user before s/he may proceed to a certain (upload) page on my site.

    They should need to check a box saying "I have read and agreed...", then click a button, BEFORE they can access the upload page.

    There should also NOT be another way to access the upload page via a URL or bookmark.

    Anyone know how to do this?

    THANKS!

    PS: Total newb here, so please assume I know next to nothing!
      • 27708 MODX Staff
      • 2,502 Posts
      This is one of those MODx-1000-ways things but let me check your user path:

      1. They are on a page on your site and they click a link (or button) to a download.
      2. They are presented with your legal mumbo-jumbo and and check the agree box, and
      3a If agreed they are presented with either the download or the download page, or
      3b If not agreed they are reminded they have to agree or get bounced to a page.

      Let me know if this is correct? Do you need to record their agreement and store the consent?

      My first instinct is to use JavaScript but if it is off it will either fail or the user will never get to the download.

      My second is that you use sessions to pass a variable from the page in step one to step two and therefore to step 3 and the download. By doing this you could make it impossible for the download to function unless the token exists from the first and second step.

      There may be a simpler method but my guess is that a snippet with the phplogic to do this would not be that tricky. The easiest method for issuing a token would be by using a form that calls the snippet with and passes the URL to it for the T&C page. You may want another snippet or a php file to handle the terms and conditions (the text can be in a document or chunk) and then check the box and have the script verify if the box is empty and return the error or send the file using http headers or to the document with a link.

      It may be possible to do this with a modifed version of eform as much of the error handling logic for the form is there already so you just need to exit the script to a document instead of issuing a validation error.

      I might guess that someone else will have another idea (probably more simple than mine)

      One other option would be to just have them register and issue the T&C upon signup unless the T&C files are different for every download.
        Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
        • 6531
        • 154 Posts
        I want pretty much what you said, except that it is for access to an ’upload’ page, not a ’download’ page.

        Basically, we want to accept user-submitted content, but first the user has to ’sign’ a release form granting us the right to use the content.

        The solutions you suggest are all WAY beyond my skills.

        Except for the last one of including it in the registration process -- that sounds like the way to go. (It also means they only have to ’agree’ once, and can then upload as much as they want.)

        Would it be possible to:
        1. Have an (e.g.) ’Upload Your Picture’ link, which
        1a. goes to the ’Upload’ page for REGISTERED users, but
        1b. goes to a ’You need to register first’ page for GUESTS

        THANKS!
          • 3749
          • 24,544 Posts
          Another way to go is to use the Personalize snippet http://modxcms.com/Personalize-2.0-871.html which shows one chunk to logged in users and another to those not logged in.

          You could use it to do what ganeshXL is suggesting.

          [!Personalize? &yesChunk=`loggedInChunk` &noChunk=`notLoggedInChunk`!]

          Then create the two chunks.

          loggedInChunk:

          <a href="[~11~]"Upload</a>



          notLoggedInChunk:

          <a href="[~12~]">Register</a>
          (replace 11 and 12 with the document IDs of your upload and register pages.)

          No matter which method you use, you’ll still need a way of kicking out users who come directly to the upload page without being logged in.

          As usual, there are a number of different ways to do that. wink

          One way to do it is to use the Personalize snippet again and make the noChunk redirect them to the login page and the yesChunk be your whole, regular upload page.

          One last tip: When working on this kind of task, it works well to open the Manager in one browser and test the site as a non-logged in user in another browser (e.g. use IE for one task and Firefox for the other). If you use the same browser, MODx as will see you as a logged in manager in both windows.

          Bob


            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