We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13736
    • 345 Posts
    All I’m seeing is a log in form on your site. I have a login form here.
    modx.acgi.org/login

    What I’m having trouble getting working is the header to be dynamic with it’s information. Like this...

    For NON-logged in viewers I want the header to display register and login links like...


    For those who are logged in I want the header to display their name and a logout link.


    How can I get this to change based on a logged in or out user?
      • 8461
      • 205 Posts
      I use the personalise on a Modx site with this line of code

      [!Personalize? &message=`Welcome back, ` &wrapper=`p` &class=`welcome`!]


      if you look into the snippet code itself you will see

      # Example Usage:
      #
      #	[[Personalize? &message=`Welcome back, ` &wrapper=`h3` &class=`welcome`]]
      #
      #	For a logged in user John, would return: 
      #	<h3 class="welcome">Welcome back, John</h3>


      This works fine for me together with the [!LoginorLogout? &docid=`12` &logintxt=`Members Log-in` &logouttxt=`Members Log-out`!] snippet

      Dont know if that helps yu or not
        • 13736
        • 345 Posts
        Where do you find the LoginorLogout snippet? Doesn’t seeem to show up in a forum search here.

          • 28042 ☆ A M B ☆
          • 24,524 Posts
          The snippet code is in the database; access it from Manager -> Manage resources -> Snippets. The snippet acts as the interface between MODx and the more complex back-end code in the files in assets/snippets/weblogin.
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 13736
            • 345 Posts
            There is not a snippet by the name of LoginorLogout in my installation. v0.9.1(rev 646). Was it left out of this package or something?

              • 28042 ☆ A M B ☆
              • 24,524 Posts
              The snippet is WebLogin.
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 13736
                • 345 Posts
                Is that an undocumented feature?
                [!LoginorLogout? &docid=`12` &logintxt=`Members Log-in` &logouttxt=`Members Log-out`!]

                I didn’t see anywhere that "LoginorLogout" was a snippet within the Weblogin snippet. I’m just trying to figure out the techniques for learning MODx here. There could be a lot of things to learn if I know where to look.

                  • 4273
                  • 356 Posts
                  it does get somewhat confusing at times doesn’t it shocked
                  I think what people should do is instead of saying what they do with this snippet or that chunk, they should put the example in the post exactly the way they have it setup to obtain a certain result otherwise a state of clueness occurrs.
                  if you got something that works for you that is similiar to how someone else wants to do it, tell us (no show us) your coding example this would be the most logical and effective way to help others.
                    SMF Bookmark Mod - check it out
                    http://mods.simplemachines.org/index.php?mod=350
                    • 4273
                    • 356 Posts
                    based on doing something like this personal text ’user’ login | logout

                    I just used the {{ LoginBlock }} chunk

                    put this [[Personalize? &message=`Greetings, ` &wrapper=`h3` &class=`welcome`]]
                    with it

                    then you can style it however you want

                    I think it would better to just come up with only one complete snippet that combines both login/logout link with personal greeting, something that is separate from the login form itself, this way the snippet could be placed anywhere,

                    keeping login/logout text independant from login form is the best way I think if it can be done
                      SMF Bookmark Mod - check it out
                      http://mods.simplemachines.org/index.php?mod=350
                      • 4273
                      • 356 Posts
                      I found it pretty useful to gut out some chunks/snippets and change from tables to div tags and restyle the way you want works out nice

                      i simply cut/paste the code for example weblogintpl and created a new one with the changes works good

                        SMF Bookmark Mod - check it out
                        http://mods.simplemachines.org/index.php?mod=350