We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38669
    • 51 Posts
    I have a pure PHP page which is viewed "alongside" my modx site. Yeah, I should incorporate it, but it is pretty complex, it works and I don't want to fix something that isn't broken.

    Is it possible to get the User ID via an existing session?

    If not, I guess the solution would be to set a session var at login and then access it like in my PHP page.

    Or is there a better way?
    • Yes. You can have your PHP page make an AJAX call to a MODx resource that has a snippet to return the user ID, and any other user data you want. That's how the Vanilla AJAX single-sign on works.
        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