Version Description
Download this release
Release Info
Developer | shinephp |
Plugin | User Role Editor |
Version | 4.55 |
Comparing to | |
See all releases |
Code changes from version 4.54 to 4.55
- changelog.txt +3 -0
- includes/classes/uninstall.php +95 -0
- includes/classes/user-role-editor.php +15 -6
- includes/loader.php +1 -0
- readme.txt +6 -7
- uninstall.php +0 -46
- user-role-editor.php +5 -2
changelog.txt
CHANGED
@@ -1,5 +1,8 @@
|
|
1 |
CHANGES LOG (full version).
|
2 |
===========================
|
|
|
|
|
|
|
3 |
= [4.54] 02.05.2020 =
|
4 |
New: Quick filter hides capabilities, which do not contain search string
|
5 |
Update: CSS enhancement: When site has many custom post types capabilities list section maximal height is limited by real height of the left side (capabilities groups) section, not by 720px as earlier.
|
1 |
CHANGES LOG (full version).
|
2 |
===========================
|
3 |
+
= [4.55] 03.06.2020 =
|
4 |
+
* Update: User Role Editor uninstallation was refactored. It fully removes the ('ure_%') user capabilities from the user roles data.
|
5 |
+
|
6 |
= [4.54] 02.05.2020 =
|
7 |
New: Quick filter hides capabilities, which do not contain search string
|
8 |
Update: CSS enhancement: When site has many custom post types capabilities list section maximal height is limited by real height of the left side (capabilities groups) section, not by 720px as earlier.
|
includes/classes/uninstall.php
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class URE_Uninstall {
|
4 |
+
|
5 |
+
private $lib = null;
|
6 |
+
private $options = null;
|
7 |
+
private $own_caps = null;
|
8 |
+
|
9 |
+
public function __construct() {
|
10 |
+
|
11 |
+
$this->lib = URE_Lib::get_instance();
|
12 |
+
$this->init_options_list();
|
13 |
+
$this->own_caps = array_keys( URE_Own_Capabilities::get_caps() );
|
14 |
+
|
15 |
+
}
|
16 |
+
// end of __construct()
|
17 |
+
|
18 |
+
|
19 |
+
private function init_options_list() {
|
20 |
+
|
21 |
+
$this->options = array();
|
22 |
+
$this->options[] = 'ure_caps_readable';
|
23 |
+
$this->options[] = 'ure_show_deprecated_caps';
|
24 |
+
$this->options[] = 'ure_hide_pro_banner';
|
25 |
+
$this->options[] = 'ure_role_additional_options_values';
|
26 |
+
$this->options[] = 'ure_task_queue';
|
27 |
+
$this->options[] = 'user_role_editor';
|
28 |
+
|
29 |
+
}
|
30 |
+
// end fo init_options_list()
|
31 |
+
|
32 |
+
|
33 |
+
private function delete_options() {
|
34 |
+
global $wpdb;
|
35 |
+
|
36 |
+
$backup_option_name = $wpdb->prefix . 'backup_user_roles';
|
37 |
+
delete_option( $backup_option_name );
|
38 |
+
foreach ( $this->options as $option_name ) {
|
39 |
+
delete_option( $option_name );
|
40 |
+
}
|
41 |
+
|
42 |
+
}
|
43 |
+
// end of delete_options()
|
44 |
+
|
45 |
+
|
46 |
+
private function delete_caps() {
|
47 |
+
|
48 |
+
|
49 |
+
$wp_roles = wp_roles();
|
50 |
+
if ( $wp_roles->use_db ) {
|
51 |
+
$wp_roles->use_db = false; // minimize database update requests
|
52 |
+
$use_db = true;
|
53 |
+
} else {
|
54 |
+
$use_db = false;
|
55 |
+
}
|
56 |
+
|
57 |
+
foreach( $wp_roles->roles as $role_id=>$role ) {
|
58 |
+
foreach( $this->own_caps as $cap ) {
|
59 |
+
if ( isset( $role['capabilities'][ $cap ]) ) {
|
60 |
+
$wp_roles->remove_cap( $role_id, $cap );
|
61 |
+
}
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
if ( $use_db ) { // save changes to the database
|
66 |
+
$wp_roles->add_cap( 'subscriber', 'dummy_cap' );
|
67 |
+
$wp_roles->use_db = true; // restore original value
|
68 |
+
$wp_roles->remove_cap( 'subscriber', 'dummy_cap' );
|
69 |
+
}
|
70 |
+
|
71 |
+
}
|
72 |
+
// end of delete_caps()
|
73 |
+
|
74 |
+
|
75 |
+
public function act() {
|
76 |
+
global $wpdb;
|
77 |
+
|
78 |
+
if ( !is_multisite() ) {
|
79 |
+
$this->delete_options();
|
80 |
+
$this->delete_caps();
|
81 |
+
} else {
|
82 |
+
$old_blog = $wpdb->blogid;
|
83 |
+
$blog_ids = $this->lib->get_blog_ids();
|
84 |
+
foreach ( $blog_ids as $blog_id ) {
|
85 |
+
switch_to_blog( $blog_id );
|
86 |
+
$this->delete_options();
|
87 |
+
$this->delete_caps();
|
88 |
+
}
|
89 |
+
$this->lib->restore_after_blog_switching( $old_blog );
|
90 |
+
}
|
91 |
+
}
|
92 |
+
// end of act()
|
93 |
+
|
94 |
+
}
|
95 |
+
// end of class URE_Uninstall
|
includes/classes/user-role-editor.php
CHANGED
@@ -81,12 +81,12 @@ class User_Role_Editor {
|
|
81 |
}
|
82 |
$this->ure_hook_suffixes = array($this->settings_hook_suffix, $this->main_page_hook_suffix);
|
83 |
|
84 |
-
//
|
85 |
-
register_activation_hook(URE_PLUGIN_FULL_PATH, array($this, 'setup'));
|
86 |
|
87 |
-
//
|
88 |
-
register_deactivation_hook(URE_PLUGIN_FULL_PATH, array($this, 'cleanup'));
|
89 |
-
|
90 |
// Who can use this plugin
|
91 |
$this->key_capability = URE_Own_Capabilities::get_key_capability();
|
92 |
|
@@ -888,11 +888,20 @@ class User_Role_Editor {
|
|
888 |
|
889 |
|
890 |
// execute on plugin deactivation
|
891 |
-
function cleanup() {
|
892 |
|
893 |
}
|
894 |
// end of setup()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
895 |
|
|
|
|
|
896 |
|
897 |
}
|
898 |
// end of User_Role_Editor
|
81 |
}
|
82 |
$this->ure_hook_suffixes = array($this->settings_hook_suffix, $this->main_page_hook_suffix);
|
83 |
|
84 |
+
// Activation action
|
85 |
+
register_activation_hook( URE_PLUGIN_FULL_PATH, array($this, 'setup') );
|
86 |
|
87 |
+
// Deactivation action
|
88 |
+
register_deactivation_hook( URE_PLUGIN_FULL_PATH, array($this, 'cleanup') );
|
89 |
+
|
90 |
// Who can use this plugin
|
91 |
$this->key_capability = URE_Own_Capabilities::get_key_capability();
|
92 |
|
888 |
|
889 |
|
890 |
// execute on plugin deactivation
|
891 |
+
public function cleanup() {
|
892 |
|
893 |
}
|
894 |
// end of setup()
|
895 |
+
|
896 |
+
|
897 |
+
// excute on plugin uninstall via WordPress->Plugins->Delete
|
898 |
+
public static function uninstall() {
|
899 |
+
|
900 |
+
$uninstall = new URE_Uninstall;
|
901 |
+
$uninstall->act();
|
902 |
|
903 |
+
}
|
904 |
+
// end of uninstall()
|
905 |
|
906 |
}
|
907 |
// end of User_Role_Editor
|
includes/loader.php
CHANGED
@@ -31,4 +31,5 @@ require_once( URE_PLUGIN_DIR .'includes/classes/user-view.php' );
|
|
31 |
require_once( URE_PLUGIN_DIR .'includes/classes/editor.php' );
|
32 |
require_once( URE_PLUGIN_DIR .'includes/classes/tools.php' );
|
33 |
require_once( URE_PLUGIN_DIR .'includes/classes/settings.php' );
|
|
|
34 |
require_once( URE_PLUGIN_DIR .'includes/classes/user-role-editor.php' );
|
31 |
require_once( URE_PLUGIN_DIR .'includes/classes/editor.php' );
|
32 |
require_once( URE_PLUGIN_DIR .'includes/classes/tools.php' );
|
33 |
require_once( URE_PLUGIN_DIR .'includes/classes/settings.php' );
|
34 |
+
require_once( URE_PLUGIN_DIR .'includes/classes/uninstall.php' );
|
35 |
require_once( URE_PLUGIN_DIR .'includes/classes/user-role-editor.php' );
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=vladi
|
|
4 |
Tags: user, role, editor, security, access, permission, capability
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.4.1
|
7 |
-
Stable tag: 4.
|
8 |
Requires PHP: 5.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -80,6 +80,9 @@ https://translate.wordpress.org/projects/wp-plugins/user-role-editor/
|
|
80 |
|
81 |
|
82 |
== Changelog =
|
|
|
|
|
|
|
83 |
= [4.54] 02.05.2020 =
|
84 |
* New: Quick filter hides capabilities, which do not contain search string
|
85 |
* Update: CSS enhancement: When site has many custom post types capabilities list section maximal height is limited by real height of the left side (capabilities groups) section, not by 720px as earlier.
|
@@ -93,10 +96,6 @@ For example courses CPT from LearnDash plugin is defined with 'course' capabilit
|
|
93 |
* Fix: Undefined variable: $message at wp-content/plugins/user-role-editor/includes/classes/editor.php:898
|
94 |
* Update: Few English grammar enhancements.
|
95 |
|
96 |
-
= [4.53] 01.02.2020 =
|
97 |
-
* Update: "Add role", "Delete role", "Rename role", "Add capability", "Delete capability" do not reload full page on completion, but use AJAX for data exchange with server and refresh parts of the page via JavaScript.
|
98 |
-
* Update: Multisite: "Allow non super administrators to create, edit, and delete users" option: priority for 'map_meta_cap' filter priority was raised from 1 to 99, in order make possible to overwrite changes made by other plugins, like WooCommerce.
|
99 |
-
* Fix: Some English grammar mistakes.
|
100 |
|
101 |
File changelog.txt contains the full list of changes.
|
102 |
|
@@ -108,5 +107,5 @@ I am ready to answer on your questions about plugin usage. Use [plugin page comm
|
|
108 |
|
109 |
== Upgrade Notice ==
|
110 |
= [4.54] 02.05.2020 =
|
111 |
-
|
112 |
-
|
4 |
Tags: user, role, editor, security, access, permission, capability
|
5 |
Requires at least: 4.0
|
6 |
Tested up to: 5.4.1
|
7 |
+
Stable tag: 4.55
|
8 |
Requires PHP: 5.6
|
9 |
License: GPLv2 or later
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
80 |
|
81 |
|
82 |
== Changelog =
|
83 |
+
= [4.55] 03.06.2020 =
|
84 |
+
* Update: User Role Editor uninstallation was refactored. It fully removes the ('ure_%') user capabilities from the user roles data.
|
85 |
+
|
86 |
= [4.54] 02.05.2020 =
|
87 |
* New: Quick filter hides capabilities, which do not contain search string
|
88 |
* Update: CSS enhancement: When site has many custom post types capabilities list section maximal height is limited by real height of the left side (capabilities groups) section, not by 720px as earlier.
|
96 |
* Fix: Undefined variable: $message at wp-content/plugins/user-role-editor/includes/classes/editor.php:898
|
97 |
* Update: Few English grammar enhancements.
|
98 |
|
|
|
|
|
|
|
|
|
99 |
|
100 |
File changelog.txt contains the full list of changes.
|
101 |
|
107 |
|
108 |
== Upgrade Notice ==
|
109 |
= [4.54] 02.05.2020 =
|
110 |
+
New: Quick filter hides capabilities, which do not contain search string
|
111 |
+
Update: CSS enhancement: When site has many custom post types capabilities list section maximal height is limited by real height of the left side (capabilities groups) section, not by 720px as earlier.
|
uninstall.php
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/*
|
3 |
-
* User Role Editor plugin uninstall script
|
4 |
-
* Author: vladimir@shinephp.com
|
5 |
-
*
|
6 |
-
*/
|
7 |
-
|
8 |
-
global $wpdb;
|
9 |
-
|
10 |
-
if (!defined('ABSPATH') || !defined('WP_UNINSTALL_PLUGIN')) {
|
11 |
-
exit(); // silence is golden
|
12 |
-
}
|
13 |
-
|
14 |
-
|
15 |
-
function ure_delete_options() {
|
16 |
-
global $wpdb;
|
17 |
-
|
18 |
-
$backup_option_name = $wpdb->prefix.'backup_user_roles';
|
19 |
-
delete_option($backup_option_name);
|
20 |
-
delete_option('ure_caps_readable');
|
21 |
-
delete_option('ure_show_deprecated_caps');
|
22 |
-
delete_option('ure_hide_pro_banner');
|
23 |
-
delete_option('user_role_editor');
|
24 |
-
delete_option('ure_role_additional_options_values');
|
25 |
-
delete_option('ure_task_queue');
|
26 |
-
|
27 |
-
}
|
28 |
-
|
29 |
-
|
30 |
-
if (!is_multisite()) {
|
31 |
-
ure_delete_options();
|
32 |
-
} else {
|
33 |
-
$old_blog = $wpdb->blogid;
|
34 |
-
// Get all blog ids
|
35 |
-
$network = get_current_site();
|
36 |
-
$query = $wpdb->prepare(
|
37 |
-
"SELECT blog_id FROM {$wpdb->blogs} WHERE site_id=%d",
|
38 |
-
array($network->id)
|
39 |
-
);
|
40 |
-
$blogIds = $wpdb->get_col($query);
|
41 |
-
foreach ($blogIds as $blog_id) {
|
42 |
-
switch_to_blog($blog_id);
|
43 |
-
ure_delete_options();
|
44 |
-
}
|
45 |
-
switch_to_blog($old_blog);
|
46 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
user-role-editor.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: User Role Editor
|
4 |
Plugin URI: https://www.role-editor.com
|
5 |
Description: Change/add/delete WordPress user roles and capabilities.
|
6 |
-
Version: 4.
|
7 |
Author: Vladimir Garagulya
|
8 |
Author URI: https://www.role-editor.com
|
9 |
Text Domain: user-role-editor
|
@@ -23,7 +23,7 @@ if ( defined( 'URE_PLUGIN_URL' ) ) {
|
|
23 |
wp_die( 'It seems that other version of User Role Editor is active. Please deactivate it before use this version' );
|
24 |
}
|
25 |
|
26 |
-
define( 'URE_VERSION', '4.
|
27 |
define( 'URE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
28 |
define( 'URE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
29 |
define( 'URE_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );
|
@@ -47,4 +47,7 @@ URE_Lib::check_version( get_bloginfo( 'version' ), $ure_required_wp_version, $ex
|
|
47 |
|
48 |
require_once( URE_PLUGIN_DIR .'includes/loader.php' );
|
49 |
|
|
|
|
|
|
|
50 |
$GLOBALS['user_role_editor'] = User_Role_Editor::get_instance();
|
3 |
Plugin Name: User Role Editor
|
4 |
Plugin URI: https://www.role-editor.com
|
5 |
Description: Change/add/delete WordPress user roles and capabilities.
|
6 |
+
Version: 4.55
|
7 |
Author: Vladimir Garagulya
|
8 |
Author URI: https://www.role-editor.com
|
9 |
Text Domain: user-role-editor
|
23 |
wp_die( 'It seems that other version of User Role Editor is active. Please deactivate it before use this version' );
|
24 |
}
|
25 |
|
26 |
+
define( 'URE_VERSION', '4.55' );
|
27 |
define( 'URE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
28 |
define( 'URE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
29 |
define( 'URE_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );
|
47 |
|
48 |
require_once( URE_PLUGIN_DIR .'includes/loader.php' );
|
49 |
|
50 |
+
// Uninstall action
|
51 |
+
register_uninstall_hook( URE_PLUGIN_FULL_PATH, array('User_Role_Editor', 'uninstall') );
|
52 |
+
|
53 |
$GLOBALS['user_role_editor'] = User_Role_Editor::get_instance();
|