Installing plugins on installation/activation

Yes, though its slightly complicated by this bug, which I discuss on this post (original: http://stephenharris.info/deactivate-other-plug-ins-on-deactivation/) They actually handle deactivating, rather than activating, but the principles are the same.

At time of writing that trac ticket has a patch committed for 3.7.

The following should activate ‘B’ when ‘A’ is activated:

//This all goes inside Plugin A.

//When A is activated. Activate B.
register_activation_hook(__FILE__,'my_plugin_A_activate'); 
function my_plugin_A_activate(){
    $dependent="B/B.php";
    if( !is_plugin_active( $dependent ) ){
         add_action('update_option_active_plugins', 'my_activate_dependent_B');
    }
}

function my_activate_dependent_B(){
    $dependent="B/B.php";
    activate_plugins( $dependent );
}