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

Get $visitor logged in

Ajaxboy

Active member
#1
What am I missing?. I am logged in.. but when It comes down to this part, it thinks I am a guest, not a logged in user..

What am I missing?.

ps: this is an independent file

PHP:
        //Initializing XenForo
        $startTime = microtime(true);
        $xenforoRoot = str_replace("\\","/", (dirname(dirname(dirname(dirname(__FILE__))))));
        $roorDir = $xenforoRoot;

        // Setup XenForo's autoloader
        require_once($xenforoRoot . '/library/XenForo/Autoloader.php');
        XenForo_Autoloader::getInstance()->setupAutoloader($xenforoRoot . '/library');

        XenForo_Application::initialize($xenforoRoot . '/library', $roorDir);
        XenForo_Application::set('page_start_time', $startTime);

        $visitor = XenForo_Visitor::getInstance()->toArray();

        if($visitor['user_id']) {

            die("user_id: {$visitor['user_id']}");
        } else {

            die(print_r($visitor,1));
        }