MyBB Community Forums

Full Version: Keep 'deactivated'
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
If you want to keep your plugin deactivated, put this code in your activate function:

	global $active_plugins, $codename;
	unset($active_plugins[$codename]);

I have this used in my "Recount User Posts" plugin, since I only want the users' posts to be recounted when the admin wants (eg. when it's activated), the plugin has no function while activated, so I found a way to make it always deactivated, so that the next time the admin wants the posts recounted, the button will say "Activate" and they wouldn't have to deactivate and reactivate the plugin to recount the posts.
Great discovery (y)

It certainly is useful for some plugins.
I just changed one of my mods to include it. Noticed that $active_plugins isn't global.
Fixed.