We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 30735
    • 18 Posts
    Hi, I’m trying to achieve the same sort of result, but to start off with I cannot even get the sign up and login snippets to work properly. I’m pretty new to MODx, only installing it today. I would be greatful if someone would be willing to help me get this up and running.

    I’m away from my computer this weekend, but I’ll check up on Monday.
      • 4273
      • 356 Posts
      check out this for signup page http://modxcms.com/blog-user-registration.html
        SMF Bookmark Mod - check it out
        http://mods.simplemachines.org/index.php?mod=350
        • 13736
        • 345 Posts
        Maybe we will get closer now that this thread has a few people participating. Here are my problems in doing what I am wanting to get it to do.

        For a new user or a "not logged in" user I want my site header to display this:

        My registeration page is here and my login page is here so creating hard coded links are easy.

        However once a user has logged in, I want to display a completely different set of information and show the users name and a logout link instead. Like this:


        So, does anyone know how I can swap out the data in my header based on whether a user is logged in or not? So far no one has been able to say how to do this.

          • 4273
          • 356 Posts
          so instead of having an actual login form where the login link would be you’ll just have a login link that takes you to a login page correct ?

          you could create a chunk with the links Register | login and before the Register place the snippet

          so your chunk might look something like this
          [[Personalize? &message=`Welcome back, ` &wrapper=`h3` &class=`welcome`]]
          a href="#" the link >Register (to the reigster form) | a href="#" the link >Login (to the login form)

          then put the {{chunk}} where you want the register/login links to go

          seems what you want is the register link to disappear to be replaced by welcome back i’m sure it can be done
          but don’t know how. that’s a good idea, we should try to figure this one out wink

          does modx acknowledge that a user has already registered thereby not allowing them to fill out the register form again ?

          some code needs to say oh that user has already registered and relace with welcome bobo
            SMF Bookmark Mod - check it out
            http://mods.simplemachines.org/index.php?mod=350
            • 13736
            • 345 Posts
            Yes, the register link should be replace or removed when logged in. And the Login link should change to the words logout. I could technicaly stay linked to the same page.

            I believe the standard login form does acknowledge a logged in user. After logging in, when I go back to the login form all I get is a log out link in place of the form.

            I’m not sure about the registration form. It does not restrict a user from registering. However it does restrict trying to register a duplicate ID or a duplicate email.
              • 13736
              • 345 Posts
              The other thing I would like to do is display the full name if available. Currently the personalize snippet only displays the user ID.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Quote from: jbjones at Apr 01, 2006, 09:06 PM

                I’m not sure about the registration form. It does not restrict a user from registering. However it does restrict trying to register a duplicate ID or a duplicate email.

                That’s why in my template chunk for my login form I added a link for registration along with the other login form features. It is hidden along with the rest of the login form when the user is logged in. The link is to a page that does not show in the menu, so the only (normal) way to access it is from the link with the login form.
                  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
                  • 4273
                  • 356 Posts
                  I tried that what you suggested about having the register link in the chunk and it still showed up after logging in could you show what you have in your chunk?
                    SMF Bookmark Mod - check it out
                    http://mods.simplemachines.org/index.php?mod=350
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    If using the default chunk:

                    ...
                    	<td colspan="2"><a href="#" onclick="webLoginShowForm(2);return false;">Forget Password?</a></td>
                      </tr>
                      <tr>
                            <td colspan="2"><a href="[~id of registration page~]">Register</a></td>
                      </tr>
                    </table>
                    </td>
                    </tr>
                    </table>
                    </form>
                    <hr>
                    <!-- log out hyperlink section -->
                    <a href='[+action+]'>[+logouttext+]</a>
                    <hr>
                    <!-- Password reminder form section -->
                    ...
                    


                    as long as the link to the registration page is inside the first part, where the login form/forgot password link is, then it will be hidden on login as is the rest of the login form. In this case, the <hr> tags act as the delimiters.
                      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
                      • 29635
                      • 361 Posts
                      Hi all. Perhaps this has already been figured out by everybody, but here’s a working example on how to set this up, exactly as jbjones wanted:

                      In your template, call the snippets:
                      [!Personalize? &ph=`personalize` &message=`Welcome back ` !]
                      [!WebLogin? &tpl=`WebLoginTop` !]


                      Create the chunk WebLoginTop:
                      <!-- #declare:separator <hr> --> 
                      <!-- login form section-->
                      <a href="[~~]" class="personalizeRegister">Register</a> or <a href="[~~]" class="personalizeLogin">Login</a>
                      <hr>
                      <!-- log out hyperlink section -->
                      [+personalize+] |
                      <a href='[+action+]'>[+logouttext+]</a>
                      <hr>
                      <!-- Password reminder form section -->
                      

                      Just make sure you actually put the IDs of the Register and Login pages in the chunk.

                      I hope that helps, newbies and more advanced users as well. It does take a second to wrap your head around the whole workings of it, but it makes great sense once you get it.
                      -Brett
                        Need MODx Ecommerce? Try FoxyCart!