Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Check whether the Contact Form 7 plugin is active.
- * If not, deactivate this one and display error message in admin panel.
- */
- register_activation_hook( __FILE__, 'wpcf7_check_CF7_is_active' );
- function wpcf7_check_CF7_is_active () {
- if (! is_plugin_active('contact-form-7/wp-contact-form-7.php')) {
- wp_mail('support@andrewgolightly.com', 'CF7 not active', 'test');
- add_action( 'admin_init', 'wpcf7_deactivate_plugin' );
- add_action( 'admin_notices', 'wpcf7_display_deactivation_notice' );
- function wpcf7_deactivate_plugin () {
- wp_mail('support@andrewgolightly.com', 'deactivating plugin', 'test');
- deactivate_plugins( __FILE__ );
- }
- function wpcf7_display_deactivation_notice () {
- wp_mail('support@andrewgolightly.com', 'posting notice of deactivation', 'test');
- echo '<div class="updated"><p>The <strong>Contact Form 7 email verification</strong> plugin has been <em>deactivated</em>. Please first install and activate the <strong>Contact Form 7 plugin/strong></p></div>';
- if ( isset( $_GET['activate'] ) )
- unset( $_GET['activate'] );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement