views:

423

answers:

2

I want to grab the User Object in Joomla in another PHP script.

Anway, what I want to do is grab the Joomla User (JUser) on a non-Joomla page. More or less I want a way to grab the joomla username, email and name etc and throw it to a php script for use in another custom application.

What is the best way to do this? Make a specialized joomla page by importing the framework, grabbing the necessary info from the user, setting those as session variables and then redirecting to the PHP page I want to use that information in?

Or do I just make some sort of link on a Joomla page with querystring variables corresponding to the current User and when they click the link I grab the info from the Querystring?

I'm looking for a best case scenario of how to get the User info to a custom application.

Any insight would be appreciated.

A: 

Best way would be to create a User plugin that logs into your script when someone logs into Joomla: http://stackoverflow.com/questions/1503004/joomla-unified-logins-for-forum-and-a-custom-made-php-sub-site/1507349#1507349

jlleblanc
A: 

depends on what you want the data for.

the juser data is serialised and stored in the session, so you could reverse engineer that and pull out the juser data... That would be messy.

alternatively you could make a plugin that stores the juser data in a session variable of your own making. the session variable will be available to other php scripts.. asuming they use the same session methods. (joomla has its own)

you could make a plugin that stores the data in a database that is assessible to the other script, or a flat file etc. in essence a similar process to using a session

You could also load up enough of joomla to use the joomla functions that you need to retrieve the juser values.. (messy)

Bingy