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

Custom HTTP errors?

Floren

Well-known member
#3
Hi Chris,

What plan to do is edit the Resources code, instead of creating a separate add-on.
I will extend the related function in Listener/Proxy/SomeAction.php and edit the Listener/Proxy.php to call it, like I did in this thread.

I'm looking at XenForo code into getNotFoundResponse() but I cannot figure how I could trigger a setHttpResponseCode(401). I guess I have to extend the Controller.php and add a new function there, but how do I trigger it? I don't see anywhere called actionErrorNotFound().

Thanks for your help.
 
Last edited:

Floren

Well-known member
#4
Here is the code I plan to use in XenForo/Controller.php:
Code:
public function getNotAuthorizedResponse()
{
    return $this->responseError(new XenForo_Phrase('requested_page_not_authorized'), 401);
}
But what function do I use in XenForo/ControllerPublic/Error.php?
Something like:
Code:
class XenForo_ControllerPublic_Error extends XenForo_ControllerPublic_Abstract
{
    public function actionErrorNotAuthorized()
    {
        return $this->getNotAuthorizedResponse();
    }
What I don't understand is how is the public function actionErrorNotFound() called, I don't see any reference anywhere? Thank you for your guidelines, guys.