We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19613
    • 70 Posts
    Hi
    I have a login form on the home page of the site (all other pages are resticted) but my client would like to have the ’logout’ option in the main menu (uses wayfinder).

    I know that the logout message can/will appear in place of the login form but the client wants to use the full width of the page (losing the LOGIN form except on the homepage) and wants to have instead a Logout in the normal flow of the horizontal menu on the page top.

    It will need to log out the user and go directly back to the home/login page in one click if possible (I made a logout page with the ’button’ on it but he said 2 clicks will confuse people(?).

    I am sure this must be possible but have no idea how... anyone able to help?
    Thanks

      • 18374
      • 69 Posts
      Could you include it as part of outerTpl? You wouldn’t have to build out a separate log out page this way.

      Quick and dirty example:
      <ul[+wf-classes+]>
      [+wf-wrapper+]
      <li><a href="/logout.php">Log Out</a></li>
      </ul>
      


      Then just use your regular outerTpl (with the login form and no logout link) on the home page.
        • 19613
        • 70 Posts
        Hi
        Thanks... I always like a quick and dirty solution... that’s why I came up with this little ’creative solution’ wink

        I used a slightly different trick to yours by referencing it in some text (so I could avoid the menu issue):

        <div class="logout">Hi, you are logged in as [[namesession]]. 
            [[WebLogin? &loginhomeid=`1` &logouthomeid=`1`]] here.</div>


        I just applied some styling to the ’logout’ css class and stuck it at the top of the content. This seems to do the trick... it apparently looks professional/good and therefore kept the client happy.

        Cheers for the input though. grin
        I am getting used to creative workarounds rolleyes

        Hope this helps someone else in the future.
          • 10313
          • 375 Posts
          Hi, I’m having a similar problem.

          I have a menu with a link "login" to a page with a login form. Works fine.

          But -- when I am logged in -- the menu still shows the "login". I would like to hide that page as soon as I have logged in. Is that possible?

          Thanks
          Martin
            • 3707
            • 241 Posts
            If you create two chunks, one with a login link and one with a logout link (or an empty chunk), you could then use the Personalize snippet to display a one chunk for logged out visitors and the other for logged in visitors.

            Or, you could use the MemberCheck snippet to check for group membership and display the appropriate chunk (if you’re not logged in, you can’t be a member of a group).

            Or, you could use PHx to do the same thing:
            [+phx:mo=`myWebgroup`:then=`{{logoutLink}}`:else=`{{loginLink}}`+]
              • 10313
              • 375 Posts
              Cool, thank you for the input. One of these will work for me smiley

              Martin

              edit: PERFECT smiley
              • W. Shawn Wilkerson Reply #7, 15 years ago
                It can even be easier.

                method 1:  create a document at the top level.  Assign it only to logged in groups and have it go directly to a logout page with  [!WebLogin?webloginmode=`lo`&logouthomeid=`1`!]

                method 2: create a weblink at the top level.  Assign it only to logged in groups and have it directly log user out [~doc id of your login page~]?webloginmode=lo

                The should look like [~37~]?webloginmode=lo  

                Remove the http://  from the link box first

                On mouse over it should like http://www.domainname.tld/logout.html?webloginmode=lo

                No scripts, no fuss, no muss, no chunks, no extra calls to the database, parser, or even to Santa Claus.

                Additional Thought:  I actually created a "Log out Page" and thought people would be fine using that.  By Taking it out of the menu, but leaving it published, I now have a text link using that logout page as the landing spot.  In the snippet call on the actual page, I had placed
                [!WebLogin?webloginmode=`lo`&logouthomeid=`490`!]

                The wonderful thing:  The menu Link pointing to this non-menued, but published logout page redirects to doc 490 anyway.  And the user is logged out with the session destroyed.

                Its the best of both worlds, without having to edit the script -- and then remember you did it at a later date.

                This results in a single click logout instead of one form the menu and then on the page, sending the user to a log out page with a message: "Y’all come back, now. Ya hear?" Not really , but you get the point
                  Get your copy of MODX Revolution Building the Web Your Way http://www.sanitypress.com/books/modx-revolution-building-the-web-your-way.html

                  Check out my MODX || xPDO resources here: http://www.shawnwilkerson.com