Created
July 9, 2014 22:08
-
-
Save curtismchale/7a319974b4c906d9f57d to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
// hooked inside a class for my normal dev work | |
add_action( 'admin_notices', 'check_required_plugins' ); | |
/** | |
* Checks for WooCommerce and kills our plugin if it isn't active | |
* | |
* @uses function_exists Checks for the function given string | |
* @uses deactivate_plugins Deactivates plugins given string or array of plugins | |
* | |
* @action admin_notices Provides WordPress admin notices | |
* | |
* @since 1.0 | |
* @author ME | |
*/ | |
public function check_required_plugins(){ | |
if ( ! is_plugin_active( 'woocommerce/woocommerce.php' ) ) { ?> | |
<div id="message" class="error"> | |
<p>Limit Products requires WooCommerce to be active. This plugin has been deactivated.</p> | |
</div> | |
<?php | |
deactivate_plugins( '/limit-products/limit-products.php' ); | |
} // compmany team if | |
} // check_required_plugins |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment