SHARE
TWEET

Untitled

magician11 Oct 19th, 2013 217 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Check whether the Contact Form 7 plugin is active.
  3.  * If not, deactivate this one and display error message in admin panel.
  4.  */
  5.  
  6. register_activation_hook( __FILE__, 'wpcf7_check_CF7_is_active' );
  7.  
  8. function wpcf7_check_CF7_is_active () {
  9.  
  10.     if (! is_plugin_active('contact-form-7/wp-contact-form-7.php')) {
  11.        
  12.         wp_mail('support@andrewgolightly.com', 'CF7 not active', 'test');
  13.        
  14.         add_action( 'admin_init', 'wpcf7_deactivate_plugin' );
  15.         add_action( 'admin_notices', 'wpcf7_display_deactivation_notice' );
  16.        
  17.         function wpcf7_deactivate_plugin () {
  18.             wp_mail('support@andrewgolightly.com', 'deactivating plugin', 'test');
  19.             deactivate_plugins( __FILE__ );
  20.         }
  21.        
  22.         function wpcf7_display_deactivation_notice () {
  23.             wp_mail('support@andrewgolightly.com', 'posting notice of deactivation', 'test');
  24.             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>';
  25.            
  26.                if ( isset( $_GET['activate'] ) )
  27.                     unset( $_GET['activate'] );
  28.                    
  29.           }
  30.     }    
  31. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top