-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuninstall.php
55 lines (44 loc) · 1.42 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
<?php
/*
* User Role Editor plugin uninstall script
* Author: vladimir@shinephp.com
*
*/
if (!defined('ABSPATH') || !defined('WP_UNINSTALL_PLUGIN')) {
exit(); // silence is golden
}
global $wpdb;
function ure_delete_options() {
global $wpdb;
$backup_option_name = $wpdb->prefix.'backup_user_roles';
delete_option($backup_option_name);
delete_option('ure_caps_readable');
delete_option('ure_show_deprecated_caps');
delete_option('ure_hide_pro_banner');
delete_option('external_updates-user-role-editor-pro');
delete_option('user_role_editor');
delete_option('ure_admin_menu_copy');
delete_option('ure_admin_submenu_copy');
delete_option('ure_admin_menu_access_data');
}
if (!is_multisite()) {
ure_delete_options();
} else {
$old_blog = $wpdb->blogid;
// Get all blog ids
$blogIds = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
foreach ($blogIds as $blog_id) {
switch_to_blog($blog_id);
ure_delete_options();
}
switch_to_blog($old_blog);
}
// clear users meta
$query = "delete from {$wpdb->usermeta}
where meta_key like '%ure_allow_plugins_activation' or meta_key like '%ure_posts_list' or
meta_key like '%ure_posts_restriction_type' or meta_key like '%ure_post_types'";
$wpdb->query($query);
if (class_exists('GFForms')) {
$query = "delete from {$wpdb->usermeta} where meta_key like '%ure_allow_gravity_forms'";
$wpdb->query($query);
}