Please refer to the given link, this should help you out.
https://adambrown.info/p/wp_hooks
Thanks
]]>new TU_ActivateGravForms();
class TU_ActivateGravForms {
public function __construct() {
// Add our methods below to the hooks
add_action('activated_plugin', array($this, 'activate'), 10, 2);
}
// Activating any plugins
public function activate($Plugin, $Network) {
if (FALSE !== stripos($Plugin, 'gravityformspolls')) {
$Blog = get_bloginfo('url');
//Add gravity forms hook when gravityformspolls is activated
function register_activation_hook($file, $function) {
$file =plugin_basename($file);
add_action('activate_gravityforms' . $file, $function);
}
}
}}
]]>
Within that registered class method, to activate another plugin, call activate_plugin(). I don’t really know if activate_plugin() will work in this context since we are in the process of activating another plugin, but it’s the first thing to try. If it fails, you may need to schedule an event in the near future that activates the plugin.
BTW, when posting code in these forums, please demarcate code with backticks or use the “code” button of the editor. Otherwise the forum’s parser corrupts your code, making it difficult for others to test your code themselves. I fixed your previous code just because I can ??
]]>