PluginProbe
Authorizer / trunk
Authorizer vtrunk
3.15.3 3.15.2 3.15.1 3.15.0 3.14.3 3.14.4 3.14.2 3.14.1 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.10 2.9.11 2.9.12 2.9.13 2.9.2 2.9.3 2.9.6 All 126 releases
authorizer / uninstall.php

uninstall.php in Authorizer trunk, at uninstall.php

55 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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_login_error' );
21 delete_option( 'auth_settings_advanced_lockouts_time_last_failed' );
22 delete_option( 'auth_settings_advanced_lockouts_failed_attempts' );
23 delete_option( 'auth_settings_access_users_approved' );
24 delete_option( 'auth_settings_access_users_blocked' );
25 delete_option( 'auth_settings_access_users_pending' );
26 delete_option( 'auth_settings_advanced_public_notice' );
27 delete_option( 'auth_settings_advanced_admin_notice' );
28 delete_option( 'auth_version' );
29
30 /**
31 * Delete multisite options.
32 */
33 if ( is_multisite() ) {
34 delete_blog_option( get_main_site_id( get_main_network_id() ), 'auth_multisite_settings' );
35 delete_blog_option( get_main_site_id( get_main_network_id() ), 'auth_multisite_settings_access_users_approved' );
36 delete_blog_option( get_main_site_id( get_main_network_id() ), 'auth_version' );
37 }
38
39 /**
40 * For security, delete blocked users (since we can't enforce their blocked
41 * status without this plugin enabled, which means they would be able to reset
42 * their passwords and log in). If they have any content, reassign it to the
43 * current user (the user uninstalling the plugin).
44 */
45 if ( ! is_multisite() ) {
46 $authorizer_reassign_user = wp_get_current_user();
47 $authorizer_blocked_users = get_users( array(
48 'meta_key' => 'auth_blocked', // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key
49 'meta_value' => 'yes', // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value
50 ) );
51 foreach ( $authorizer_blocked_users as $authorizer_blocked_user ) {
52 wp_delete_user( $authorizer_blocked_user->ID, $authorizer_reassign_user->ID );
53 }
54 }
55