Hello, Dolly in the upper right of your admin screen on every page. Author: Matt Mullenweg Version: 1.5 Author URI: http://ma.tt/ */ /* -------- BEGIN MODIFICATION TO DEMONSTRATE DEPENDENCY --------- */ // Runs every time plugins.php is loaded function dependency_check(){ global $pagenow; if ( $pagenow != 'plugins.php' ){ return; } // Set your requirements $required_plugin = 'akismet/akismet.php'; $dependant_plugin = 'hello.php'; // If this plugin is being activated if ( isset($_GET['activate']) && $_GET['activate'] == 'true' ) { if ( $plugins = get_option('active_plugins') ){ if ( !in_array( $required_plugin , $plugins ) ){ if ($keys = array_keys($plugins,$dependant_plugin) ) { unset($plugins[$keys[0]]); if ( update_option('active_plugins',$plugins) ){ unset($_GET['activate']); add_action('admin_notices', 'required_plugin_missing_warning'); } } } } }elseif( ( (isset($_GET['action']) && $_GET['action'] == 'deactivate' ) ) && ( isset($_GET['plugin']) && $_GET['plugin'] == $required_plugin ) ){ if ( $plugins = get_option('active_plugins') ){ if ( in_array( $dependant_plugin , $plugins ) ){ if ($keys = array_keys($plugins,$dependant_plugin) ) { unset($plugins[$keys[0]]); if ( update_option('active_plugins',$plugins) ){ add_action('admin_notices', 'dependant_plugin_deactivated'); } } } } } } if ( is_admin() ){ add_action('plugins_loaded','dependency_check'); } // Add's notification div when admin attempts to activate dependent plugin without without required plugin function required_plugin_missing_warning(){ ?>

Plugin Not Activated. You must install and activate Akismet for hello dolly to work.

Hello Dolly Deactivated. Hello Dolly is dependant on Akismet. It cannot be reactivated until Akismet is reactivated first.

$chosen

"; } // Now we set that function up to execute when the admin_footer action is called add_action('admin_footer', 'hello_dolly'); // We need some CSS to position the paragraph function dolly_css() { echo " "; } add_action('admin_head', 'dolly_css'); ?>