Created
July 17, 2014 18:27
-
-
Save collinprice/d903be180944459ae35a to your computer and use it in GitHub Desktop.
Wordpress Plugin Dependancy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'admin_init', 'check_wpjobboard_activate' ); | |
function check_wpjobboard_activate() { | |
if ( is_admin() && current_user_can( 'activate_plugins' ) && !is_plugin_active( 'wpjobboard/index.php' ) ) { | |
add_action( 'admin_notices', 'wpjobboard_timesheets_plugin_notice' ); | |
deactivate_plugins( plugin_basename( __FILE__ ) ); | |
if ( isset( $_GET['activate'] ) ) { | |
unset( $_GET['activate'] ); | |
} | |
} | |
} | |
function wpjobboard_timesheets_plugin_notice(){ | |
?><div class="error"><p>Sorry, but Child Plugin requires the Parent plugin to be installed and active.</p></div><?php | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment