MyBB Community Forums

Full Version: Overriding a core function using plugin hooks
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey, I'm attempting to create a landing page for my forums. My idea was to use the error_nopermission template for the landing page, but it only allows you to change a fraction of the page and the rest of the layout is in the error template. Since my aim is to only modify the layout of one error page without changing the others, I tried to use a plugin hook to stop the execution of the error function if the error "message" is the landing page. The issue is that it isn't able to access any other templates (or global variables in general). I have tried multiple different ways of fixing it, but the main code is this:

$plugins->add_hook("error", "landing_nopermission");


function landing_nopermission($error) {
    if (strpos($error, "landing") != FALSE) {
        output_page($error);
        exit;
    }
}


Any help (or a more elegant solution) would be appreciated.