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

Get $visitor logged in

Discussion in 'XenForo Development Discussions' started by Ajaxboy, Feb 16, 2011.

  1. Ajaxboy

    Ajaxboy Active Member

    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));
            }
     
  2. Ajaxboy

    Ajaxboy Active Member

    Any Ideas? why it is not recognizing the session
     
  3. James

    James Well-Known Member

  4. Ajaxboy

    Ajaxboy Active Member

    Thx bud... this made the trick..

    PHP:
    XenForo_Session::startPublicSession();
     
    James likes this.
  5. Ajaxboy

    Ajaxboy Active Member

    is there any chance this code would trigger a "security error"?
     

Share This Page