Subscribe: RSS
  • 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
      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';
      }


        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
      • 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!
        • 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).
            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
          • 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