1

Hi iam developing a plugin to activated a couple of plugins. i.e: the plugin jetpack has six plugins and all gets activated on a single install,like wise i need to activate a group of plugins from acivating this plugin.

for example consider a plugin called 'site plugin' which has sub folders of other plugins. when i activate 'site plugin' it should show options to activate other plugins in it.

I hope some one could help me.

1
  • Are these child plugins developed by third parties or are they all your own code?
    – scribu
    Commented Jun 30, 2011 at 15:23

1 Answer 1

2

You're main pluggin can use register_activation_hook and use the function you register thru the hook to activate you're necesary pluggins.

Smth along these lines :

    // get already activated plugins
    $plugins = get_option('active_plugins');
    $puginsToActiv = array('Plugin1', 'Plugin2', 'Plugin3');
    if($plugins)
    {
        $changed = false;
        foreach ($puginsTostActiv as $plugin)
        {
            if (!in_array($plugin, $plugins))
            {
                $changed = true;
                array_push($plugins,$plugin);
            }
        }

        if ( $changed )
            update_option('active_plugins',$plugins);
    }
// code not tested
2
  • Or you could use activate_plugin() found in wp-admin/includes/plugin.php
    – scribu
    Commented Jun 30, 2011 at 15:24
  • @scribu : yes you could use that too
    – poelinca
    Commented Jul 1, 2011 at 2:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.