1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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

Discussion in 'XenForo Development Discussions' started by rhodes, Dec 12, 2013.

  1. rhodes

    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
     
  2. borbole

    borbole Well-Known Member

  3. rhodes

    rhodes Active Member

    Hi @borbole ,

    thanks for this link. I also found this thread, but unfortunately there is no solution for my problem.
     

Share This Page