MyBB Community Forums

Full Version: How to Detect Whether a Plugin is Activated from external file?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
My next plugin is a security one, and thus, it should not be known that the plugin is even there.

Usually, from an external page, when a plugin controlling it isn't activated, the page turns blank. Is there a way I can set it so that it returns a 404 error instead? (Only when the plugin isn't activated)
header("HTTP/1.0 404 Not Found");

?
But I want it to do that ONLY if the plugin isn't activated. That's the real code I'm looking for.
<?php
define("IN_MYBB", 1);
require_once "<PATH TO FORUM>/global.php";

$plugins = $cache->read("plugins");
if(!$plugins['active']['PLUGIN_NAME'])
{ /* REDIRECT STUFF */ }
?>

Didn't test it; but should be something like this =P
Thanks Smile