We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28215
    • 4,149 Posts
    [[!+modx.user.id:is=`0`:then=`Not logged in`:else=`Logged in`]]
      shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
      • 20407
      • 82 Posts
      Thanks for the quick reply Shaun, but that still gives me ’logged in’ when I’m not! sad
        • 20407
        • 82 Posts
        This worked:
        [[!+username:is=``:then=`Not logged in`:else=`Logged in`]]


        thanks again
          • 20407
          • 82 Posts
          Spoke too soon... now it says ’Not logged in’ whether I am or not!
            • 20407
            • 82 Posts
            OK, I think I figured it out -- use empty string instead of zero: [[!+modx.user.id:is=``:then=`Not logged in`:else=`Logged in`]]
              • 3749
              • 24,544 Posts
              I think this might be more reliable in the front end:

              [[!+username:is=`(anonymous)`:then=`Not logged in`:else=`Logged in`]]


              Remember that when you’re previewing from the Manager, it won’t necessarily work the way it would for a regular front-end user.

                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
                • 13736
                • 345 Posts
                Remember that when you’re previewing from the Manager, it won’t necessarily work the way it would for a regular front-end user.

                That’s why I usually develop with a couple browsers open: Chrome, Firefox, IE, Safari. One in the manager side of things and one as a guest or logged as a test user.
                  • 20407
                  • 82 Posts
                  Quote from: BobRay at Jan 06, 2011, 11:36 PM

                  I think this might be more reliable in the front end:
                  Yes, that is better. Thanks Bob.
                    • 20407
                    • 82 Posts
                    Either something changed when I moved the site live, or I didn’t test properly, but the ’(anonymous)’ test doesn’t work now, so I went back to testing for empty id.
                      • 17016
                      • 138 Posts
                      We didn´t find a site where it is described how to add a logout-link? How does this link have to look like? Does anybody know this?

                      Letti