Loading Controllers

Robust

Well-known member
I don't think my controller is loading properly

Error:

The following error occurred:
The controller XenForo_ControllerPublic_Member does not define an action called Userslike.

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

Code:
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)
        );
    }
}

Listener:

Code:
public static function load_controller($class, array &$extend)
    {
        if ($class == 'XenForo_ControllerPublic_Member')
        {
            $extend[] = 'newProfileTabs_Extend_ControllerPublic_Member';
        }
    }

82e69444d1f747a421d00d58ae77a0ce.png
 
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.
 
In your error
The following error occurred:
The controller XenForo_ControllerPublic_Member does not define an action called Userslike.

The controller
newProfileTab_ViewPublic_Member_UsersLike
 
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)
 
Top Bottom