-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathuninstall.php
47 lines (41 loc) · 1.08 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
<?php
// Exit if uninstall constant is not defined
if (!defined('WP_UNINSTALL_PLUGIN')) exit;
// Delete options
$options = array(
'scouting_oidc_client_id',
'scouting_oidc_client_secret',
'scouting_oidc_scopes',
'scouting_oidc_user_display_name',
'scouting_oidc_user_birthdate',
'scouting_oidc_user_gender',
'scouting_oidc_user_scouting_id',
'scouting_oidc_user_name_prefix',
'scouting_oidc_user_auto_create',
'scouting_oidc_login_redirect',
);
foreach ($options as $option) {
if (get_option($option)) delete_option($option);
}
// Delete transients
$transients = array(
'scouting_oidc_well_known_data',
'scouting_oidc_jwks_data',
);
foreach ($transients as $transient) {
if (get_transient($transient)) delete_transient($transient);
}
// Delete user meta
$metas = array(
'scouting_oidc_id',
'scouting_oidc_birthdate',
'scouting_oidc_scopes',
'scouting_oidc_infix',
);
$users = get_users();
foreach ($users as $user) {
foreach ($metas as $meta) {
if (get_user_meta($user->ID, $meta)) delete_user_meta($user->ID, $meta);
}
}
?>