We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15083
    • 697 Posts
    Hi there,

    Using WebLoginPE to handle user login, registration etc.
    One big problem, when I register as a new user, the session gets cleared.

    This becomes a major problem as I have all my orders and my whole shopping cart in there!
    Is there a way to stop this from happening, without hacking the class?

    Thanks

    J

    UPDATE: Just wondering can you access WebloginPE custom fields from getWebUserInfo();
    Is there a function that will get the custom data also?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      I would use a plugin and serialize the SESSION array to file using the OnBeforeWebLogin event, then unserialize it and reload the SESSION using the OnWebLogin event. This part would first check to make sure the user was logged in appropriately.
        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
        • 15083
        • 697 Posts
        Another issue I have found, is there a way to automatically log a user in when they register, IE no need to enter username and pasword etc?
        I have tried calling Login function but the session does not get set?
          • 15083
          • 697 Posts
          OK so I know people will be mad at me for doing this....but I took a more direct (dangerous) approach.
          I commented out the line to destroy the session.
          I wrote a custom function to do what the login function does, but with the data just submitted from the register function.

          Bit of a sloppy workaround? wink

          I dont like hacking snippets, but was in a hurry :0
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Not at all! Snippet are just snippets; the unforgivable is to hack the MODx core files wink wink
              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