Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Jun 30 '11 at 14:26

This question came from our site for professional and enthusiast programmers.

    
Are these child plugins developed by third parties or are they all your own code? –  scribu Jun 30 '11 at 15:23
add comment

1 Answer 1

up vote 1 down vote accepted

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
share|improve this answer
    
Or you could use activate_plugin() found in wp-admin/includes/plugin.php –  scribu Jun 30 '11 at 15:24
    
@scribu : yes you could use that too –  poelinca Jul 1 '11 at 2:04
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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