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

Need to fetch current username in PHP callback method

Discussion in 'XenForo Development Discussions' started by gginni, May 5, 2013.

  1. gginni

    gginni Active Member

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


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

    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
  2. gginni

    gginni Active Member

    After searching in few files..I got to know that below code is used to get userid:-

    But how to get username
  3. Brogan

    Brogan XenForo Moderator Staff Member

  4. gginni

    gginni Active Member

    I did that myself for first time by looking at other files

    $object = XenForo_Visitor::getInstance();
    $username = $object['username'];
  5. gginni

    gginni Active Member

Share This Page