| 1 |
<?php |
| 2 |
/** |
| 3 |
* Remove traces of plugin when uninstalling it. |
| 4 |
* |
| 5 |
* @package authorizer |
| 6 |
*/ |
| 7 |
|
| 8 |
/** |
| 9 |
* Exit if uninstall not called from WordPress. |
| 10 |
*/ |
| 11 |
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 12 |
exit(); |
| 13 |
} |
| 14 |
|
| 15 |
/** |
| 16 |
* Delete options in database. |
| 17 |
*/ |
| 18 |
delete_option( 'auth_settings' ); |
| 19 |
delete_option( 'auth_settings_recently_sent_emails' ); |
| 20 |
delete_option( 'auth_settings_advanced_admin_notice' ); |
| 21 |
delete_option( 'auth_settings_advanced_login_error' ); |
| 22 |
delete_option( 'auth_settings_advanced_lockouts_time_last_failed' ); |
| 23 |
delete_option( 'auth_settings_advanced_lockouts_failed_attempts' ); |
| 24 |
|
| 25 |
/** |
| 26 |
* Delete multisite options. |
| 27 |
*/ |
| 28 |
if ( is_multisite() ) { |
| 29 |
delete_blog_option( BLOG_ID_CURRENT_SITE, 'auth_multisite_settings' ); |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* For security, delete blocked users (since we can't enforce their blocked |
| 34 |
* status without this plugin enabled, which means they would be able to reset |
| 35 |
* their passwords and log in). If they have any content, reassign it to the |
| 36 |
* current user (the user uninstalling the plugin). |
| 37 |
*/ |
| 38 |
if ( ! is_multisite() ) { |
| 39 |
$current_user = wp_get_current_user(); |
| 40 |
$blocked_users = get_users( array( |
| 41 |
'meta_key' => 'auth_blocked', |
| 42 |
'meta_value' => 'yes', |
| 43 |
)); |
| 44 |
foreach ( $blocked_users as $blocked_user ) { |
| 45 |
wp_delete_user( $blocked_user->ID, $current_user->ID ); |
| 46 |
} |
| 47 |
} |
| 48 |
|