Skip to content

Instantly share code, notes, and snippets.

@sybrew
Created November 13, 2017 10:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sybrew/c9a9e8b0900f36cf597210372e53c75d to your computer and use it in GitHub Desktop.
Save sybrew/c9a9e8b0900f36cf597210372e53c75d to your computer and use it in GitHub Desktop.
Deletes TSFEM activation settings.
<?php
/**
* Plugin Name: Reset TSFEM activation settings
* Plugin URI: https://theseoframework.com/
* Description: Activate this plugin to remove TSF - Extension Manager activation settings.
* Author: Sybre Waaijer
* Version: 1.0.0
* Author URI: https://cyberwire.nl/
*/
defined( 'ABSPATH' ) and add_action( 'admin_init', function() {
$success = false;
if ( defined( 'TSF_EXTENSION_MANAGER_SITE_OPTIONS' ) && TSF_EXTENSION_MANAGER_SITE_OPTIONS ) {
$success = delete_option( TSF_EXTENSION_MANAGER_SITE_OPTIONS );
} else {
$success = delete_option( 'tsf-extension-manager-settings' );
}
register_deactivation_hook( __FILE__, function() use ( $success ) {
add_action( 'admin_notices', function() use ( $success ) {
printf( '<div class="notice updated"><p>%s</p><p>%s</p><p>%s</p></div>',
$success ? 'Successfully removed TSFEM activation settings.' : 'TSFEM activation settings have already been removed.',
'"Reset TSFEM activation settings" has been deactivated instantly.',
'You can safely remove plugin <strong>"Reset TSFEM activation settings"</strong>.'
);
} );
} );
deactivate_plugins( plugin_basename( __FILE__ ) );
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment