Retrieving user's session data externally

Retrieving user's session data externally

per Jason Ward,
Number of replies: 4
Now, I know this may be an odd way to go about this, and I'd more than appreciate nudges/guidance into a proper direction, but right now I'm stuck at the end of this:

On the same server but outside of Moodle's root, I am trying to verify if a user is currently logged in to Moodle (in regards to loosely integrating the Phorum application, to be specific). To do this, I am accessing the MoodleSession cookie, searching on the 'sesskey' field and retrieving 'sessdata', and here's where I'm stuck.

It appears that its an object (that's just a guess) stored in a longtext field, and I cannot figure out how to convert into something I can access/parse/whatever. When I attempt to use the data returned, I get something like "Resource id 20". I cannot access the member variables of it, as it is not returned as an object.

Any help here would be appreciated.

-Jason
Average of ratings: -
In reply to Jason Ward

Re: Retrieving user's session data externally

per Mike Worth,
Have you tried doing a var_dump? This should tell you exactly what the variable is that you're looking at

Mike
In reply to Mike Worth

Re: Retrieving user's session data externally

per Chris Maley,
We have tried using the var dump and all it gives us is a simple string Moodle#19 or Moodle #20. Is there a way to access the info that is usually in the $USER global externally using the cookie?
In reply to Chris Maley

Re: Retrieving user's session data externally

per Chris Maley,
This can be solved be setting separate individual cookie instance and pulling from that cookie.