We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 42535
    • 52 Posts
    I have been doing a lot of work on the Wayfinder-driven menus on my site of late, and have made much progress with what I've wanted to accomplish. My latest challenge is to have a page name change based on whether the user is actively logged in to the site or not.

    I created a document that is a child to another document. This page is added to a pop-up submenu by Wayfinder and am making that call un-cached. I have also set the child page as not cacheable. For the page Title and Menu Title fields (I had originally populated only the Title field) I used "[[*loginLogout]]" as the value.

    I created a Template Value called loginLogout and set the Input default value to:
    @EVAL if ($modx->getLoginUserID()) return 'Log Out/Profile'; else return 'Log In';


    Opening a browser and browsing to my site renders the content properly. The last menu item, Members, has a pop-up menu with only one option on it: Log In. This is working as designed. Clicking either Members or Log In will bring the user to the same content and they will be allowed to enter a username and password. Successful login results in the user being returned to the site's Home page.

    At this point, if you hover over Members, there are four new pages that are available (access controls), and the Login page is still listed as well. The problem is that the Login page is actually a Log In / Log Out / Profile Management page - which content is shown is decided by whether or not the user is actively logged in.

    The problem is that, from the Home page, the last item on the Members submenu says "Log In" and it should say "Log Out/Profile" instead. From all of the other active pages, the last Members submenu item is correct.

    Clearly, the evaluation formula works because I do get the right value being passed in many cases. But, in certain cases, it seems as if the TV is not being evaluated early enough in the process for the page to get the correct name.

    Any input on this?
      • 3749
      • 24,544 Posts
      Some things to try:


      • Try various combinations of cached and uncached tags. You can use any tag in revolution uncached with [[!
      • Put the login/logout option somewhere else on the page as a link.
      • Remove the login/logout option from the menu, but have it displayed at the end of the menu, styled as if it's part of the menu.
        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
        • 42535
        • 52 Posts
        Quote from: BobRay at Jul 14, 2013, 10:27 PM
        Some things to try:


        • Try various combinations of cached and uncached tags. You can use any tag in revolution uncached with [[!
        • Put the login/logout option somewhere else on the page as a link.
        • Remove the login/logout option from the menu, but have it displayed at the end of the menu, styled as if it's part of the menu.

        Thanks.

        I had been thinking "I wonder if there's a way to force the call to be uncached," but never actually TRIED putting the exclamation point in to test. smiley

        Works fine with that parameter in there. I appreciate the little push in the right direction.
          • 3749
          • 24,544 Posts
          I'm glad you got it sorted. Thanks for reporting back. 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