[wp-hackers] Activating another Plugin when Activating a Plugin
Mohammad Jangda
batmoo at gmail.com
Fri Dec 10 17:28:58 UTC 2010
On Fri, Dec 10, 2010 at 12:02 PM, Scott Kingsley Clark <scott at skcdev.com>wrote:
> Just checking in here, has anyone here ever attempted to activate
> another plugin (or ensure it's activated, if not, then activate it)
> within a plugin? For example, when activating Plugin B, the Plugin B
> will activate Plugin A first (or if Plugin A is activated, continue;
> if Plugin A doesn't exist then send error to browser), then complete
> the rest of Plugin B specific activation.
>
It's doable. You can use the is_plugin_active (
http://codex.wordpress.org/Function_Reference/is_plugin_active) and
activate_plugin
functions. (Though, it might be better to do a function_exists /
class_exists check instead if you already have specifics of the plugin).
Examples:
scribu has a sweet plugin that handles dependencies (
http://scribu.net/wordpress/plugin-dependencies).
I wrote a similar one too that installs and activates required plugins for
you (but it requires action from the user to install/activate the
dependencies) (
http://code.google.com/p/living-stories/source/browse/installer/living-story-installer.php?repo=wordpress&r=6036037fa0e338b15e032d4c1e5d31563b20f55a
).
More information about the wp-hackers
mailing list