MyBB Community Forums

Full Version: Check if a plugin is active?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey,

Is there a function that allows me to check if a certin plugin is enabled?
Well you could do this. Add this code to an file and upload it to your forum folder and it will show if it's active or disabled.

<?php
define("IN_MYBB", 1);
require_once "./global.php";

$plugin_name = 'wordcount';
$plugincache = $cache->read("plugins");
if($plugincache['active'][$plugin_name]) {
	echo $plugin_name." is active";
} else {
	echo $plugin_name." is disabled";
}
?>

Change wordcount, on the line
$plugin_name = 'wordcount';, to whatever the plugins filename is -.php
Thanks, thats perfect for what I want to do.