Wordpress check if another plugin active

Snippet

Create a loader.php file that links the new plugin's initialization to another plugin's initialization. Add the new plugin's code to a separate file to load only if the initialization succeeds.

/*
Plugin Name: My Plugin
Plugin URI: http://example.org/my-plugin/
Description: My BuddyPress plugin
Version: 1.0
Requires at least: WordPress 2.9.1 / BuddyPress 1.2
Tested up to: WordPress 2.9.1 / BuddyPress 1.2
License: GNU/GPL 2
Author: Some Person
Author URI: http://example.org/me/
*/
 
/* Only load the BuddyPress plugin functions if BuddyPress is loaded and initialized. */
function my_plugin_init() {
	require( dirname( __FILE__ ) . '/my-plugin-bp-functions.php' );
}
add_action( 'bp_init', 'my_plugin_init' );
 
/* Add any code here that does not rely on Buddypress */