Hello Mayur,
Try this out, it's commented, so that should help you understand it.
<?php
register_activation_hook( __FILE__, 'myplugin_activate' ); // Register myplugin_activate on
function myplugin_activate() {
$plugin = plugin_basename( __FILE__ ); // 'myplugin'
if ( is_plugin_active( 'plugin-directory/first-plugin.php' ) ) {
// Plugin was active, do hook for 'myplugin'
} else {
// Plugin was not-active, uh oh, do not allow this plugin to activate
deactivate_plugins( $plugin ); // Deactivate 'myplugin'
}
}
?>
If this throws out an error, you could also check the 'option' of 'myplugin' and set it to false or not activated.
Regards,
Techtiq Solutions,