We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9995
    • 1,613 Posts
    I have a simple link called 'login'.
    When you click on that you go to the resource with a loginform.
    When logged in the link needs to say 'logout'.

    How can I use phx to do this?

    // When logged in show =`logout-link` else = `login-link`
      Evolution user, I like the back-end speed and simplicity smiley
      • 42838
      • 28 Posts
      You can write a simple snippet. Snippet should check whether the user is authorized. It's simple. You can get information here http://bobsguides.com/modx-snippet-faq.html
        • 22840
        • 1,572 Posts
        Try the Personalize snippet, I think it can do that ( from memory )

        http://modx.com/extras/package/?id=personalize20
          • 9995
          • 1,613 Posts
          It's not that simple for me.

          That link is mainly Rev stuff. If I understand it good,

          if ($modx->user->get('username') == '(anonymous)') {
              /* user is not logged in */
          } 


          But I can't use get for Evo.
            Evolution user, I like the back-end speed and simplicity smiley
            • 37105
            • 194 Posts
            Try:
            [[+modx.user.id:gt=`0`:then=`logout-link`:else=`login-link`]]

            When a user is not logged in, the id is empty.
              Codeplaza Webdesign: for professional websites at low cost
              • 22840
              • 1,572 Posts
              Quote from: fourroses666 at Apr 05, 2013, 03:51 AM
              It's not that simple for me.

              That link is mainly Rev stuff. If I understand it good,

              But I can't use get for Evo.

              That link states "Requires Evolution 1.0.x or greater"
                • 42838
                • 28 Posts
                mmm... i found solution for Evo. It use validate $_SESSION['webValidated'].
                What you need do? i ready make snippet for you, if project is it your personal site.
                  • 9995
                  • 1,613 Posts
                  I will try Personalize.

                  @DonQuicky, I need it for Evo.
                    Evolution user, I like the back-end speed and simplicity smiley
                    • 37105
                    • 194 Posts
                    Yep, I saw it directly after my reply. You can solve it to upgrade to Revolution .... just kidding smiley
                      Codeplaza Webdesign: for professional websites at low cost
                      • 9995
                      • 1,613 Posts
                      Its not a private site.

                      I have in the uppercorner a link to the login page.
                      <a href="[~10~]">Login</a>


                      When someone is logged in, the link should change to:
                      <a href="[~10~]">Logout</a>
                        Evolution user, I like the back-end speed and simplicity smiley