We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10152
    • 156 Posts
    Hello,
    Is it possible in Revo to allow resources to the (anonymous) users only ?

    Because my current menu looks like this :
    <nav>
        <ul>
    
            [[!Wayfinder]]
    
            <!-- show login and register links if NOT logged only  -->
            [[If? &operator=`EQ` &operand=`(anonymous)` &subject=`[[+modx.user.username]]` &then=`loginchunk`]]
            [[If? &operator=`EQ` &operand=`(anonymous)` &subject=`[[+modx.user.username]]` &then=`registerchunk`]]
    
            <!-- show logout link if logged only  -->
            [[If? &operator=`NEQ` &operand=`(anonymous)` &subject=`[[+modx.user.username]]` &then=`logoutchunk`]]
    
        </ul>     
    </nav>
    


    For the moment I hide some resources of the menu with the If snippet when the user is logged. Eg : the "register" and "login" page must hide when already logged.

    I would like to use wayfinder only, instead of several following [[If]].


    thanks for any support


    EDIT : of course I’ve made a search through the forum and attempted many kinds of things before asking here, like creating a "Anonymous" resource group and link it to the (anonymous) in "Access control".
      • 3749
      • 24,544 Posts
      That last method you mentioned should work. Did you flush permissions and the cache and then check in another browser where you’re not logged in to the manager?

      If that doesn’t work (though I haven’t tried it), I think it would be simpler to just have one "if" and show the logged in users the same menu but with some docs excluded with &excludeDocs.
        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
        • 28215
        • 4,149 Posts
        Like Bob said,
        [[If? &operator=`EQ` &operand=`(anonymous)` &subject=`[[+modx.user.username]]` &then=`loginchunk`]]


        will work.

        As for integrating with Wayfinder, well...hrm. I don’t know if that’s possible. Jason may chime in later and say it is, but to as far as I know, I’m not sure how.
          shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
          • 10152
          • 156 Posts
          thank you BobRay it worked finally, only after cleaning the cache manually.
            • 3749
            • 24,544 Posts
            Glad it worked. smiley

            For the benefit of others, are you saying that putting it in a resource group and linking that group with the (anonymous) user group by creating a Resource Group Access ACL entry worked?
              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
              • 10152
              • 156 Posts
              Yes it did.

              Step 1 : Create an "Anonymous" resource group and place the resources that you want to hide to authentified users.

              Step 2 : in the ACL page, update the (anonymous) user group. Skip the first fields and go directly at "resource group access", and add the resource group Anonymous ( minimum role : 9999, access policies : Resource )
                • 3749
                • 24,544 Posts
                Excellent. Thanks. smiley
                  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
                  • 10152
                  • 156 Posts
                  You are welcome, actually it works, but not if parent folder belongs to another group that is forbidden.
                    • 3749
                    • 24,544 Posts
                    I’m not sure, but I think you might be able to get around that by putting those forbidden folders in a resource group and giving the anonymous users access to it with a policy that includes only the "load" permission.
                      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
                      • 14372
                      • 49 Posts
                      Yes, for others out there I can confirm that the permissions method works and in my opinion is much better, rather than just hiding the link.

                      My process
                      -----------

                      1. Created NotLoggedIn Only Resource Group
                      2. Added the resources I want hidden to the ’not logged in’
                      3. Update the Anonymous User Group with Resource Group Access Policy
                      4. Add the resource group Anonymous


                      • Minimum role : 9999
                        Access policies : Resource
                        Resource Group: NotLoggedIn Only
                        Context: Web

                      BUT ... it only worked also after I MANUALLY cleared the cache.

                      NB: Using 2.1.0-pl