forked from wp-plugins/wp-members
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathuninstall.php
103 lines (86 loc) · 2.93 KB
/
uninstall.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/**
* WP-Members Uninstall
*
* Removes all settings WP-Members added to the WP options table
*
* This file is part of the WP-Members plugin by Chad Butler
* You can find out more about this plugin at https://rocketgeek.com
* Copyright (c) 2006-2023 Chad Butler
* WP-Members(tm) is a trademark of butlerblog.com
*
* @package WP-Members
* @author Chad Butler
* @copyright 2006-2023
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit();
}
// If uninstall is not called from WordPress, kill the uninstall.
if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
die( 'invalid uninstall' );
}
// Uninstall process removes WP-Members settings from the WordPress database (_options table).
if ( WP_UNINSTALL_PLUGIN ) {
if ( is_multisite() ) {
global $wpdb;
$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs" );
$original_blog_id = get_current_blog_id();
foreach ( $blog_ids as $blog_id ) {
switch_to_blog( $blog_id );
wpmem_uninstall_options();
}
switch_to_blog( $original_blog_id );
} else {
wpmem_uninstall_options();
}
}
/**
* Compartmentalizes uninstall
*
* @since 2.9.3
*/
function wpmem_uninstall_options() {
delete_option( 'wpmembers_settings' );
delete_option( 'wpmembers_fields' );
delete_option( 'wpmembers_dialogs' );
delete_option( 'wpmembers_captcha' );
delete_option( 'wpmembers_tos' );
delete_option( 'wpmembers_export' );
delete_option( 'wpmembers_utfields' );
delete_option( 'wpmembers_usfields' );
delete_option( 'wpmembers_dropins' );
delete_option( 'wpmem_hidden_posts' );
delete_option( 'wpmembers_email_newreg' );
delete_option( 'wpmembers_email_newmod' );
delete_option( 'wpmembers_email_appmod' );
delete_option( 'wpmembers_email_repass' );
delete_option( 'wpmembers_email_footer' );
delete_option( 'wpmembers_email_notify' );
delete_option( 'wpmembers_email_wpfrom' );
delete_option( 'wpmembers_email_wpname' );
delete_option( 'wpmembers_email_getuser' );
delete_option( 'wpmembers_email_validated' );
delete_option( 'widget_wpmemwidget' );
// For pre-3.x settings that may remain.
delete_option( 'wpmembers_msurl' );
delete_option( 'wpmembers_regurl' );
delete_option( 'wpmembers_logurl' );
delete_option( 'wpmembers_cssurl' );
delete_option( 'wpmembers_style' );
delete_option( 'wpmembers_autoex' );
delete_option( 'wpmembers_attrib' );
delete_transient( 'wpmem_user_counts' );
// Drop user meta key search table.
global $wpdb;
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}wpmembers_user_search_keys" );
$optin = get_option( 'wpmembers_optin' );
if ( 1 == $optin ) {
include_once( plugin_dir_path( __FILE__ ) . 'includes/vendor/rocketgeek-tools/class-rocketgeek-satellite.php' );
$uninstall = new RocketGeek_Satellite_Beta( 'wp-members', plugin_dir_path( __FILE__ ) . 'wp-members.php', 'delete', 'plugin' );
}
delete_option( 'wpmembers_optin' );
delete_option( 'wpmembers_install_state' );
}
// End of file.