We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51020
    • 670 Posts
    Hi,

    I just created a members page, and set up the permissions so that only logged in members of a particular resource group can view it.
    I've used the Login Extra to create the front end login form, but come up against a problem:

    I want to show the members page link within wayfinder (so that users know it exists) and then when the click on it, it directs them to the login page, (which is hidden from menus).
    Currently, unless the user is logged in, the link is invisible to wayfinder.

    Any tips?

    Thanks (as always!)
    Andy
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Try pdoTools and its pdoMenu snippet instead. It will ignore permissions when generating a menu unless you tell it to check for specific permissions with &checkPermissions
      http://docs.modx.pro/en/components/pdotools/snippets/pdomenu

      You will need to have a proper "unauthorized" page assigned in the System Settings, in your case it will be your login resource.
        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
        • 51020
        • 670 Posts
        One thing I tried to get round it was to hide the members page from the menus, and then change the name of the login page in the menu to 'members' , but the problem with this is that when a user is logged in, and then click on members (actually login) they are taken back to the login page so that doesn't work!

          • 28042 ☆ A M B ☆
          • 24,524 Posts
          For that, you would use the Personalize snippet. http://bobsguides.com/personalize-tutorial.html

          See this for a tutorial that uses it for exactly what you what https://rtfm.modx.com/extras/revo/login/login.tutorials/login.request-membership
            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
            • 51020
            • 670 Posts
            OK thanks I'll check that out.
              • 51020
              • 670 Posts
              Quote from: sottwell at Dec 08, 2015, 10:53 AM
              For that, you would use the Personalize snippet. http://bobsguides.com/personalize-tutorial.html

              See this for a tutorial that uses it for exactly what you what https://rtfm.modx.com/extras/revo/login/login.tutorials/login.request-membership

              Hmm.. have been playing around with the personalize script, but that doesn't really help I don't think.

              The only way I can get that to work is to put all my content of my members area inside the 'no_chunk' - but that wont make it very easy to update, and doesn't actually tak the user to the members only page.

              Unless I've got the wrong end of the stick?

              Andy
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Your "no-chunk" would have a link to the login page, or the login form if you prefer. The "yes-chunk" would have a link to your resource, as well as a logout link. Or anything else you want the logged-in user to have.

                As an example, on one site I use this as my Login resource's Menu Title
                [[!Personalize? &yesChunk=`membersMenuTpl` &noChunk=`visitorsMenuTpl` &ph=`name`]]

                The membersMenuTpl just says "Your Profile", while the vistiorsMenuTpl just says "Login". The URL is the same in either case; the page it links to handles what to do if the user is logged in or not with another Personalize snippet to either display the login form or the user's profile with a link to edit his profile as well as a logout link.

                The point is that your Personalize chunks can contain anything you want. And of course you can always use the Login snippet's &loginResourceId property to send the user to whatever page you want on login.
                  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
                  • 51020
                  • 670 Posts
                  Ah I see. Thanks.
                  The only problem is that the menu items are pulled in via wayfinder so not sure I could use this call within that?
                  Also, I have two separate member pages, that require two different levels. For example if I'm a member of 'staff' I can see the staff pages but not the 'shareholder' pages - unless I'm also a member of the shareholders resource group.

                  I assume that the above method would automatically reveal both sections by default?

                  Andy
                    • 3749
                    • 24,544 Posts
                    You can put two different Wayfinder calls in the Yes and No chunks if that will help.
                      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
                      • 51020
                      • 670 Posts
                      Quote from: BobRay at Dec 08, 2015, 02:59 PM
                      You can put two different Wayfinder calls in the Yes and No chunks if that will help.

                      I got this working thanks - the only problem is that I have two members pages which require separate logins (ie, one user will only have access to one of the protected pages). So when the user is logged into the first page and then tries to access the second page, the login form doesn't appear, as it sees that the user is logged in already.