How to get the User ID in Route Handling Files

robdog

Well-known member
PHP:
class CLASS_NAME implements XenForo_Route_Interface, XenForo_Route_BuilderInterface
{
    public function match($routePath, Zend_Controller_Request_Http $request, XenForo_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.
 
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.
 
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.
 
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.

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