We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30912
    • 463 Posts
    Good Afternoon!

    I'm trying to organise some member only downloads, but there is other content attributed to the downloads. I'm uing a weblink to link to the file but i have some other TV's content related to the template of the Weblink.

    What i want to do is display the TV data in a chunk for getResources but only when they click the actual link, they get redirected to the login page if they are not logged in.

    I can control access to the document already. but i want to control access too the [[*content]] field of the weblink only - is this possible?

    Thanks [ed. note: Tyreal2012 last edited this post 12 years, 3 months ago.]
    • I'm pretty sure phx (output modifiers) will be your answer; it has a conditional to check if the user is looged in. You can use that to output the URL as to the file if yes and another the link (in your case you'd want a link to the login page) if no.

      http://rtfm.modx.com/display/revolution20/Input+and+Output+Filters+%28Output+Modifiers%29 [ed. note: sottwell last edited this post 12 years, 3 months ago.]
        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
        • 30912
        • 463 Posts
        Solution posted here:

        <a href="[[~[[+id:isloggedin:is=`1`:then=`[[~[[+id]]]]`:else=`[[~19]]`]]]]">


        Sorry - still learning MODx Revo, so much to learn smiley

        EDIT: Solution Posted above - found a my MODx book out and there was a refernce in there for a chunk of the same kind [ed. note: Tyreal2012 last edited this post 12 years, 3 months ago.]
        • I'm afraid I don't know any more; I haven't gotten to that point in working with Revo yet. I'm sure someone who knows more about it will respond soon.
            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
            • 30912
            • 463 Posts
            Seems we're both in the same boat smiley thanks for the start though!
            • I suspect you'll actually need to see about making a custom snippet to return the desired URL; see the "Creating a Custom Modifier" section of the page I linked to.
                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
                • 30912
                • 463 Posts
                Just needed the correct Syntax smiley
                • Would you post your solution? I'd be very interested.
                    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
                    • 30912
                    • 463 Posts
                    already did at reply #3 smiley

                    edit: a different version using a TV as the input is:

                    [[+tv.File:isloggedin:is=`1`:then=`[[+tv.File]]`:else=`[[~19]]`]]


                    You need to ensure that you prefix the value with tv. unless you ahve defined the prefix in the getResources call [ed. note: Tyreal2012 last edited this post 12 years, 3 months ago.]