MyBB Community Forums

Full Version: Invalid forum plugin?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a way to check for invalid forum before the main script starts checking its things like setting cookies and stuff?

I would like to create a plugin that will return 301 header for invalid forum, thread, post?


{
    global $mybb;
    
   $fid = intval($mybb->input['fid']);
   $foruminfo = get_forum($fid);
if(!$foruminfo)
{
	if (in_array($mybb->user['usergroup'], array('3','4','6'))) {
error("Invalid Forum");
}
else
{
header("Location: {$mybb->settings['bburl']}", true, 301);
exit();
}  
}          
}

For some it works but for many it doesn't cause it says:

http://letsforum.com/Forum-Adwords-Forum - 301 Moved Permanently

http://letsforum.com/forumdisplay.php?fid=163 - 301 Moved Permanently

Why it should redirect to my homepage not to fid?

How can I fix that?