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

How to get the User ID in Route Handling Files

Discussion in 'XenForo Development Discussions' started by robdog, Nov 26, 2011.

  1. robdog

    robdog Well-Known Member

    PHP:
    class CLASS_NAME implements XenForo_Route_InterfaceXenForo_Route_BuilderInterface
    {
        public function 
    match($routePathZend_Controller_Request_Http $requestXenForo_Router $router)
        {
            
    $visitor XenForo_Visitor::getInstance();
            
    print_r($visitor);
        }
    }
    Visitor is always returning a NON-logged in user.(yes I am logged in) What am I missing?

    Thanks.
     
  2. robdog

    robdog Well-Known Member

    Sorry to bump my own thread, but still trying to figure this out. Basically want the same route handler to render the page differently if they user is logged in or not.
     
  3. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    I just tested this. It appears the visitor object is not yet built at this point in the execution. You will have to do the check elsewhere, such as in the controller action.
     
  4. robdog

    robdog Well-Known Member

    That is what I was afraid of. Thanks for checking on that for me.
     

Share This Page