Need to fetch current username in PHP callback method

gginni

Active member
I have created a new page node following below guideline:-

http://xenforo.com/community/threads/editing-templates-and-defining-a-callback-for-pages.7226/

And now I need to fetch current logged-in username in PHP callback method.... Means in PHP callback method having below signature:-

Code:
public static function respond(XenForo_ControllerPublic_Abstract $controller,  XenForo_ControllerResponse_Abstract $response)
        {

I couldn't find any development doc..please let me know how to access current logged-in user user name
 
After searching in few files..I got to know that below code is used to get userid:-

Code:
XenForo_Visitor::getUserId();

But how to get username
 
I did that myself for first time by looking at other files

Code:
$object = XenForo_Visitor::getInstance();
$username = $object['username'];
 
Back
Top Bottom