We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46886
    • 1,154 Posts
    In wrapper.tpl my login box does not appear, but if i am logged in the user box appears (but my avatars are broken). I just upgraded to the newest Revo.

    So it seems this works
    [[+discuss.user.id:notempty=`


    But this does not
      [[+discuss.user.id:is=``:then=`


    And can someone provide a code to provide a login box if there is no user logged in, I dont think i need to use discuss to check this.

    This question has been answered by BobRay. See the first response.

    • discuss.answer
      • 3749
      • 24,544 Posts
      I think there is a way to do it with output modifiers. Personalize will also do it, but this custom snippet is a little faster:

      [[!LoginOrNothing]]


      /* LoginOrNothing snippet */
      if ($modx->user->hasSessionContext('web')) {
         return 'Whatever you want for a logged in user';
      } else {
         return 'Whatever you want for a NOT-logged in 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
        • 46886
        • 1,154 Posts
        Hmm that seems to throw an error, the line is where the urlmaker code is.
        a href="[[DiscussUrlMaker? &action=`user` &params=`{"type":"username", "user":"[[+discuss.user.username]]"}`]]"


        I found that it works to bring back the login stuff! But what I did was leave the first part of the code blank (because of the above issue) and now have the opposite problem. So, I left the user panel stuff in the original code, and only return blank or the login with the snippet.

        Thanks so much!
          • 3749
          • 24,544 Posts
          I'm glad you got it sorted. That code of mine has no error, but you might have introduced one when you filled in what you want to return(e.g., a single quote inside the single quotes).
            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
            • 46886
            • 1,154 Posts
            Yeah that's what happened, the code for the user box made an error. So, I cut it out. Luckily the login box didn't. There must be some way to isolate the code inside, but I don't need it.

            Now, I get the login box, or it returns empty. So, login, or nothing.

            Isn't that why you gave it that name? wink