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

Loading Controllers

Discussion in 'XenForo Development Discussions' started by Robust, Dec 25, 2014.

  1. Robust

    Robust Well-Known Member

    I don't think my controller is loading properly


    If I throw my function directly into XenForo_ControllerPublic_Member it works fine. Outside of that, I get that error.

    class newProfileTabs_Extend_ControllerPublic_Member extends XFCP_newProfileTabs_Extend_ControllerPublic_Member
        public function actionUsersLike()
            $userId = $this->_input->filterSingle('user_id', XenForo_Input::UINT);
            $user = $this->getHelper('UserProfile')->assertUserProfileValidAndViewable($userId);
            $users_likes = $this->getModelFromCache('newProfileTabs_Model_newProfileModel')->getAllGivenLikesByUser($userId, '10');
            return $this->responseView(
                'newProfileTab_ViewPublic_Member_UsersLike', 'newProfileTab_ourTab_content',
                array('user' => $user, 'users_likes' => $users_likes)

    public static function load_controller($class, array &$extend)
            if ($class == 'XenForo_ControllerPublic_Member')
                $extend[] = 'newProfileTabs_Extend_ControllerPublic_Member';
  2. Chris D

    Chris D XenForo Developer Staff Member

    The event hint is wrong.

    The event hint should be the name of the class you are extending.

    This also means you don't need the if ($class == whatever) bit in the listener.
  3. Steve F

    Steve F Well-Known Member

    In your error
    The controller
  4. Robust

    Robust Well-Known Member

  5. Robust

    Robust Well-Known Member

    Aaand... Issue

    The server responded with an error. The error message is in the JavaScript console.

    [Error] PHP q{"templateHtml":"","js":"","css":"","term":"Like","cssClasses":{"like":"+","unlike":"-"},"_visitor_conversationsUnread":"0","_visitor_alertsUnread":"0"}
    handleServerError (xenforo.js, line 231)
    error (xenforo.js, line 226)
    j (jquery-1.11.0.min.js, line 2)
    fireWith (jquery-1.11.0.min.js, line 2)
    x (jquery-1.11.0.min.js, line 4)
    b (jquery-1.11.0.min.js, line 4)

Share This Page