View Full Version : Disabling/Enabling a plugin in PHP
dushan26
06-11-2013, 12:30 AM
I am creating a custom cpnav menu for a product I am making and one of the options is to enable/disable certain aspects of the product. To disable these aspects I must disable the plugins they depend on.
My question is: How would I go about disabling/enabling a plugin in PHP? I tried having the PHP change the active column to zero in the plugin table but that does not work.
Paul M
06-11-2013, 12:54 AM
It will work, you just need to rebuild the datastore afterwards.
Calling build_product_datastore() will do that (you need to make sure adminfunctions.php has been loaded).
However, Im not sure why you would present such an option, its a bit odd (and how would they re-enable it).
dushan26
06-11-2013, 08:43 PM
Thank you for your help.
I need this option because I want to make it easy for users to disable certain functionality within the product. Disabling these functionalities requires the user to disable more than one plugin, so I figure it will be more user friendly if its done automatically.
To re-enable the plugin I figured I'd just set active to 1 and do as you said. I'm doing:
vBulletinHook::build_datastore($db);
and also...
$vbulletin->GPC['active']["{//plugin id}"] = //0 or 1;
Paul M
06-11-2013, 08:49 PM
I need this option because I want to make it easy for users to disable certain functionality within the product.
Then you are doing it the wrong way. :)
Create a custom setting (or settings) in the options, and use them to enable or disable code (using IF statements).
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.