We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36760
    • 136 Posts
    Currently running MODX Revolution 2.1.3-pl (traditional)

    I have a website I’m setting up for a client that will have a subscription access area, with a bunch of resources not available to the public or people with free accounts. The client wanted an outline of all the articles, which I setup using Wayfinder. They also want all of the "restricted" articles (the ones that show up only with a paid subscription) to show in the outline as well, but not linked to the pages. Mostly to act as a little teaser of what’s available.

    Right now I just have all of the different permissions setup to show or hide articles based on all the variables they need, which is working fine with Wayfinder. I just don’t know how I can get the pages people aren’t supposed to see to show up in Wayfinder, without making them available to everyone at the same time (i.e. removing the permission restrictions). I don’t even know if it’s possible.

    I appreciate any help.
      • 3749
      • 24,544 Posts
      You could do it with &includeDocs=`1,3,5,4,77`, but it’s not a very elegant solution and the links to non-member pages would lead them to the error page.

      Another way would be to hide the pages with a snippet in the template rather then permissions.

      The snippet would forward non-members to the registration page (which would have a message saying "you need to be a member to see that page."

      That’s still not very elegant because the users would have no way of knowing which links would land them on the page and which would ask them to register, unless you prefix the menutitle of some pages with "members-only" or something similar.

      Another way would be to hard-code two different menus into two different chunks, one for members and one for non-members. I’ve done that on sites where the menu was short and seldom changed. A modified version of that would be to have two menus, one below the other, that looked like one big menu and put the member pages in the second one -- shown to the non-members as a text rather than links.

      You might also be able to inject JavaScript for non-members that would make the member-pages links do nothing.

      Maybe someone else can suggest a more sensible way of doing it.

        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
        • 36760
        • 136 Posts
        Thanks for the suggestions. I’ll think about some of them, but I think you’re right, something more elegant would be in order. Otherwise I’ll go with my backup plan of just having a chunk with a hard coded list of pages that free members can’t see, sort of like what you had suggested.

        Thanks again!
          • 33968
          • 863 Posts
          If you’re familiar with the api you might look at modifying the Wayfinder class to retrieve all resources regardless of permissions, but set different row templates for your ’members-only’ resources without any links.

          That way you might end up with a more elegant solution, but it’s going to be more work to implement too wink
            • 36760
            • 136 Posts
            I am not familiar with the API at all, but I would be willing to take a look at learning it. If not for this project, at least for future ones (the client is in rush-mode right now). Where would you suggest I start?
              • 33988
              • 110 Posts
              Wayfinder is better for making menus, but it does account for permissions. For this you could make a simple list with getResources. If you would like a UL that has the pages in the various levels, you could actually put a separate getResources call within the tpl and it should work out alright. This can be a little cumbersome though.

              Alternatively you could write a simple sitemap maker that does exactly what you want.
                Sal Sodano
                President & Co-Founder of SkyToaster
                My Website Salscode.
                • 3749
                • 24,544 Posts
                I think I would use either the SiteMapFriend or GoogleSiteMap snippets (more likely the former) and rewrite (and rename) the snippet so it checked resource group membership and used a different Tpl for public and private pages.



                  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