We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37286
    • 160 Posts
    I don't really care about logout, I'm fine with it the way it is. My problem is that login does not seem to want to redirect back to the page it was referred from. My snippet is simple:

    [[!Login? &redirectToPrior=`1` &loginTpl=`lgnLoginTpl.page`]]


    Again, the hidden form field "returnUrl" does contain the url of the page that I was previously on, but for some reason it does not want to send me back to that page. I also decided to test &loginResourceId and it doesn't appear to work either. I just go back to the login page rather than the page I specify.

    I am curently using Revolution 2.2.2 with login 1.8.0
      • 37131
      • 111 Posts
      On my site it works properly (both loginResourceId and redirectToPrior). I use MODX 2.2.4 and Login 1.8.0

      So, you land on login page, but you are logged in ?
        ---
        Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. Martin Golding
        • 37286
        • 160 Posts
        Yes, so the login page displays the logout template.
          • 37131
          • 111 Posts
          Is login page = your home page ?

          What pages you have set for Unauthorized and Unavailable (404) ?
            ---
            Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. Martin Golding
            • 37286
            • 160 Posts
            Login page is resource id 2, everything else is set to the home page.
              • 37131
              • 111 Posts
              I have no more ideas, it's working on my setup, so it works (at least sometimes). It must be some difference in configuration.
              I use XAMPP 1.7.7 on localhost and on Windows Server, MODX is configured for relative paths, FURL mode = on, login pages configured as in Login Tutorial.
                ---
                Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. Martin Golding
                • 37286
                • 160 Posts
                I even tried updating to 2.2.4 and it doesn't want to work. I was hoping there was some hidden setting somewhere that was causing the problem. I am on a basic hosting service.
                  • 37286
                  • 160 Posts
                  While not the solution I was hoping for, I did find a way to get redirectToPrior to work. In the Login.php file, approx line 329, is:
                  $loginResourceId = $this->getProperty('loginResourceId',$redirectBack); 
                  I commented out this line and everything works the way I want.

                  I'm sure there is probably a better solution out there but I've already spent to much time on this little headache. If anyone else happens upon the better solutions, please let me know.
                    • 37131
                    • 111 Posts
                    This looks like the same solution as removing loginResourceId parameter from Login snippet, it's good it works for you now smiley
                      ---
                      Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. Martin Golding
                      • 3749
                      • 24,544 Posts
                      Yes, if both &loginResourceId and &redirectToPrior are set, the snippet has no way of knowing which one to use.


                      ------------------------------------------------------------------------------------------
                      PLEASE, PLEASE specify the version of MODX you are using.
                      MODX info for everyone: http://bobsguides.com/modx.html
                        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