XF 2.2 How to make this single PHP file edit as XF2 addon?

rdn

Well-known member
So it will not be overwritten every XF upgrades.
Basically, I want to return 404 for private threads/forums instead of 403 status.

File to Edit
/src/XF/ControllerPlugin/Error.php

Change line 72 & 75

PHP:
    public function actionRegistrationRequired()
    {
        $view = $this->view('XF:Error\RegistrationRequired', 'login', [
            'error' => \XF::phrase('requested_page_not_found'),
            'providers' => \XF::repository('XF:ConnectedAccount')->getUsableProviders(false)
        ]);
        $view->setResponseCode(404);

        return $view;
    }

Changes are:
requested_page_not_found & 404
 
Top