We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6516
    • 2 Posts
    Is there something special I should do to Wayfinder so that it stops showing hidden pages AFTER a user has logged out? Hidden menu does NOT show BEFORE the user logs in. That's good. It DOES show AFTER the user has logged in. But after the user logs out, the menu item continues to show. Clicking on it does not display the hidden page (it defaults to the home page), but it's annoying that this menu item continues to show after logout.

    Using Revo 2.0.8-pl, wayfinder version 2.3.3.

    Thanks,
    Dan
      • 6516
      • 2 Posts
      Nevermind. I think I figured it out. Wayfinder was caching results, so menu items that did show up when the user was logged in continued to show up after the user logged out. Made a simple replacement:

      FROM [[Wayfinder? ....
      TO [[!Wayfinder? ....

      -Dan
        • 3749
        • 24,544 Posts
        I'm not positive that this will work, but I think you might be able to speed things up by putting the uncached Wayfinder tag (and nothing else) in two separate chunks called "LoggedIn" and "NotLoggedIn" and using a snippet to display the appropriate chunk:

        [[!ShowMenu]]



        <?php
        /*ShowMenu snippet */
        
             $chunk = $modx->user->hasSessionContext($modx->context->get('key'))  ? 'LoggedIn' : 'NotLoggedIn';
        
        return $modx->getChunk($chunk);
        


        That way, the two menus would be cached and Wayfinder wouldn't have to recreate them on every page visit.


        ---------------------------------------------------------------------------------------------------------------
        PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
        MODx info for everyone: http://bobsguides.com/MODx.html
          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
          • 36621
          • 3 Posts
          Thanks for the feedback Bob.

          In several places of the code, I already split it out into two different chunks depending on whether or not the user is logged in. I didn't think I had to do it for Wayfinder as well ... but in hindsight, I should have thought of it and implemented it this way. Fortunately, it's not too late to make the change.

          BTW: I'm enjoying your new book. smiley

          Dan
            • 3749
            • 24,544 Posts
            Thanks for buying the book. smiley


            ---------------------------------------------------------------------------------------------------------------
            PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
            MODx info for everyone: http://bobsguides.com/MODx.html
              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