How can I get a xf user ID from an external PHP script?

rhodes

Active member
Hello,

my xf is installed in develop.dev/forum.

I also installed a cms system in my webservers root (develop.dev). When executing develop.dev/anycmsscript.php I would like to know if the current user has logged in to xf.

I had a look at the REST api but as far as I can see action=getUser only will return user data if one already knows the user id.

In $_COOKIE only the xf_session string is available, but no user ID.

I also tried the bootstrap version
....
XenForo_Autoloader::getInstance()->setupAutoloader(XF_ROOT . '/library');
XenForo_Application::initialize(XF_ROOT . '/library', XF_ROOT);
....

This works fine for a single php file outside the cms. But when I include the script into my cms this solution collides with some of my cms modules.

My favorite solution would be to use the REST API but I don't know if any suitable action is available. Any ideas? (can I extend the actions with my own addon?)

Thank you & regards

rhodes
 
Back
Top Bottom