User Role Editor - Version 4.63

Version Description

Download this release

Release Info

Developer shinephp
Plugin Icon 128x128 User Role Editor
Version 4.63
Comparing to
See all releases

Code changes from version 4.62 to 4.63

changelog.txt CHANGED
@@ -1,5 +1,9 @@
1
  CHANGES LOG (full version).
2
  ===========================
 
 
 
 
3
 
4
  = [4.62] 05.05.2022 =
5
  * Update: Marked as compatible with WordPress 6.0
1
  CHANGES LOG (full version).
2
  ===========================
3
+ = [4.63] 11.07.2022 =
4
+ * Update: Marked as compatible with WordPress 6.1
5
+ * Update: Few notices (e.g. "Constant FILTER_SANITIZE_STRING is deprecated") was fixed for better compatibility with PHP 8.1.
6
+ * Update: URE does not try to deactivate itself in case another instance is active, just shows notice and stops execution.
7
 
8
  = [4.62] 05.05.2022 =
9
  * Update: Marked as compatible with WordPress 6.0
includes/classes/base-lib.php CHANGED
@@ -113,6 +113,26 @@ class URE_Base_Lib {
113
  // end of show_message()
114
 
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  /**
117
  * Returns value by name from GET/POST/REQUEST. Minimal type checking is provided
118
  *
@@ -128,14 +148,14 @@ class URE_Base_Lib {
128
  switch ( $request_type ) {
129
  case 'get': {
130
  if ( isset( $_GET[$var_name] ) ) {
131
- $result = filter_var( $_GET[$var_name], FILTER_SANITIZE_STRING );
132
  }
133
  break;
134
  }
135
  case 'post': {
136
  if ( isset( $_POST[$var_name] ) ) {
137
  if ( $var_type!='checkbox') {
138
- $result = filter_var( $_POST[$var_name], FILTER_SANITIZE_STRING );
139
  } else {
140
  $result = 1;
141
  }
@@ -144,7 +164,7 @@ class URE_Base_Lib {
144
  }
145
  case 'request': {
146
  if ( isset( $_REQUEST[$var_name] ) ) {
147
- $result = filter_var( $_REQUEST[$var_name], FILTER_SANITIZE_STRING );
148
  }
149
  break;
150
  }
113
  // end of show_message()
114
 
115
 
116
+ /*
117
+ * Replacer for FILTER_SANITIZE_STRING deprecated with PHP 8.1
118
+ */
119
+ public static function filter_string_polyfill(string $string): string {
120
+
121
+ $str = preg_replace('/\x00|<[^>]*>?/', '', $string);
122
+ return str_replace(["'", '"'], ['&#39;', '&#34;'], $str);
123
+
124
+ }
125
+ // end of filter_string_polyfill()
126
+
127
+ public static function filter_string_var( $raw_str ) {
128
+
129
+ $value1 = filter_var( $raw_str, FILTER_UNSAFE_RAW );
130
+ $value2 = self::filter_string_polyfill( $value1 );
131
+
132
+ return $value2;
133
+ }
134
+ // end of filter_string_var()
135
+
136
  /**
137
  * Returns value by name from GET/POST/REQUEST. Minimal type checking is provided
138
  *
148
  switch ( $request_type ) {
149
  case 'get': {
150
  if ( isset( $_GET[$var_name] ) ) {
151
+ $result = self::filter_string_var( $_GET[$var_name] );
152
  }
153
  break;
154
  }
155
  case 'post': {
156
  if ( isset( $_POST[$var_name] ) ) {
157
  if ( $var_type!='checkbox') {
158
+ $result = self::filter_string_var( $_POST[$var_name] );
159
  } else {
160
  $result = 1;
161
  }
164
  }
165
  case 'request': {
166
  if ( isset( $_REQUEST[$var_name] ) ) {
167
+ $result = self::filter_string_var( $_REQUEST[$var_name] );
168
  }
169
  break;
170
  }
includes/classes/editor.php CHANGED
@@ -675,7 +675,7 @@ class URE_Editor {
675
 
676
  $select_primary_role = apply_filters( 'ure_users_select_primary_role', true );
677
  if ( $select_primary_role || $this->lib->is_super_admin()) {
678
- $role = isset( $_POST['values']['primary_role'] ) ? filter_var( $_POST['values']['primary_role'], FILTER_SANITIZE_STRING ) : false;
679
  if ( empty( $role ) || !isset( $wp_roles->roles[$role] ) ) {
680
  $role = '';
681
  }
675
 
676
  $select_primary_role = apply_filters( 'ure_users_select_primary_role', true );
677
  if ( $select_primary_role || $this->lib->is_super_admin()) {
678
+ $role = isset( $_POST['values']['primary_role'] ) ? URE_Base_Lib::filter_string_var( $_POST['values']['primary_role'] ) : false;
679
  if ( empty( $role ) || !isset( $wp_roles->roles[$role] ) ) {
680
  $role = '';
681
  }
includes/classes/role-view.php CHANGED
@@ -120,7 +120,7 @@ class URE_Role_View extends URE_View {
120
  $caps = array_keys($caps_to_remove);
121
  asort($caps);
122
  $network_admin = filter_input(INPUT_POST, 'network_admin', FILTER_SANITIZE_NUMBER_INT);
123
- $current_role = filter_input(INPUT_POST, 'current_role', FILTER_SANITIZE_STRING);
124
  if (!isset($wp_roles->roles[$current_role])) {
125
  $current_role = '';
126
  }
120
  $caps = array_keys($caps_to_remove);
121
  asort($caps);
122
  $network_admin = filter_input(INPUT_POST, 'network_admin', FILTER_SANITIZE_NUMBER_INT);
123
+ $current_role = isset( $_POST['current_role'] ) ? URE_Base_Lib::filter_string_var( $_POST['current_role'] ) : '';
124
  if (!isset($wp_roles->roles[$current_role])) {
125
  $current_role = '';
126
  }
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: shinephp
3
  Tags: user, role, editor, security, access, permission, capability
4
  Requires at least: 4.4
5
- Tested up to: 6.0
6
- Stable tag: 4.62
7
  Requires PHP: 7.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -21,6 +21,8 @@ Capabilities could be assigned on per user basis. Multiple roles could be assign
21
  You can add new capabilities and remove unnecessary capabilities which could be left from uninstalled plugins.
22
  Multi-site support is provided.
23
 
 
 
24
  To read more about 'User Role Editor' visit [this page](http://www.shinephp.com/user-role-editor-wordpress-plugin/) at [shinephp.com](http://shinephp.com)
25
 
26
 
@@ -80,17 +82,17 @@ https://translate.wordpress.org/projects/wp-plugins/user-role-editor/
80
 
81
  == Changelog =
82
 
 
 
 
 
 
83
  = [4.62] 05.05.2022 =
84
  * Update: Marked as compatible with WordPress 6.0
85
  * New: It's possible to translate custom role names using [PolyLang](https://wordpress.org/plugins/polylang/) plugin.
86
  * Update: URE does not sort roles in WordPress dropdown lists. In order to sort roles by name return 'name' from 'ure_sort_wp_roles_list' filter.
87
  * Update: User capabilities view page minor CSS enhancements.
88
  * Update: Settings->About: "Donate" link was removed.
89
-
90
- = [4.61.2] 01.03.2022 =
91
- * Update: Marked as compatible with WordPress 5.9.1
92
- * Fix: "Users->Add New" page - other selected roles were not saved.
93
- * Update: URE uses WordPress notification styles for own operation result output.
94
 
95
  File changelog.txt contains the full list of changes.
96
 
@@ -102,11 +104,10 @@ I am ready to answer on your questions about plugin usage. Use [plugin page comm
102
 
103
  == Upgrade Notice ==
104
 
105
- = [4.62] 01.05.2022 =
106
- * Update: Marked as compatible with WordPress 6.0
107
- * New: It's possible to translate custom role names using [PolyLang](https://wordpress.org/plugins/polylang/) plugin.
108
- * Update: URE does not sort roles in WordPress dropdown lists. In order to sort roles by name return 'name' from 'ure_sort_wp_roles_list' filter.
109
- * Update: User capabilities view page minor CSS enhancements.
110
- * Update: Settings->About: "Donate" link was removed.
111
 
112
 
2
  Contributors: shinephp
3
  Tags: user, role, editor, security, access, permission, capability
4
  Requires at least: 4.4
5
+ Tested up to: 6.0.1
6
+ Stable tag: 4.63
7
  Requires PHP: 7.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
21
  You can add new capabilities and remove unnecessary capabilities which could be left from uninstalled plugins.
22
  Multi-site support is provided.
23
 
24
+ Try it out on your free TasteWP [test site](https://demo.tastewp.com/user-role-editor)
25
+
26
  To read more about 'User Role Editor' visit [this page](http://www.shinephp.com/user-role-editor-wordpress-plugin/) at [shinephp.com](http://shinephp.com)
27
 
28
 
82
 
83
  == Changelog =
84
 
85
+ = [4.63] 11.07.2022 =
86
+ * Update: Marked as compatible with WordPress 6.1
87
+ * Update: Few notices (e.g. "Constant FILTER_SANITIZE_STRING is deprecated") was fixed for better compatibility with PHP 8.1.
88
+ * Update: URE does not try to deactivate itself in case another instance is active, just shows notice and stops execution.
89
+
90
  = [4.62] 05.05.2022 =
91
  * Update: Marked as compatible with WordPress 6.0
92
  * New: It's possible to translate custom role names using [PolyLang](https://wordpress.org/plugins/polylang/) plugin.
93
  * Update: URE does not sort roles in WordPress dropdown lists. In order to sort roles by name return 'name' from 'ure_sort_wp_roles_list' filter.
94
  * Update: User capabilities view page minor CSS enhancements.
95
  * Update: Settings->About: "Donate" link was removed.
 
 
 
 
 
96
 
97
  File changelog.txt contains the full list of changes.
98
 
104
 
105
  == Upgrade Notice ==
106
 
107
+ = [4.63] 11.07.2022 =
108
+ * Update: Marked as compatible with WordPress 6.1
109
+ * Update: Few notices (e.g. "Constant FILTER_SANITIZE_STRING is deprecated") was fixed for better compatibility with PHP 8.1.
110
+ * Update: URE does not try to deactivate itself in case another instance is active, just shows notice and stops execution.
111
+
 
112
 
113
 
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.62
7
  Author: Vladimir Garagulya
8
  Author URI: https://www.role-editor.com
9
  Text Domain: user-role-editor
@@ -21,8 +21,6 @@ if ( ! function_exists( 'get_option' ) ) {
21
 
22
  if ( defined( 'URE_VERSION' ) ) {
23
  if ( is_admin() && ( !defined('DOING_AJAX') || !DOING_AJAX ) ) {
24
- require_once ABSPATH . '/wp-admin/includes/plugin.php';
25
- deactivate_plugins( __FILE__ );
26
  if ( !class_exists('URE_Admin_Notice') ) {
27
  require_once( plugin_dir_path( __FILE__ ) .'includes/classes/admin-notice.php' );
28
  }
@@ -31,7 +29,7 @@ if ( defined( 'URE_VERSION' ) ) {
31
  return;
32
  }
33
 
34
- define( 'URE_VERSION', '4.62' );
35
  define( 'URE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
36
  define( 'URE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
37
  define( 'URE_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );
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.63
7
  Author: Vladimir Garagulya
8
  Author URI: https://www.role-editor.com
9
  Text Domain: user-role-editor
21
 
22
  if ( defined( 'URE_VERSION' ) ) {
23
  if ( is_admin() && ( !defined('DOING_AJAX') || !DOING_AJAX ) ) {
 
 
24
  if ( !class_exists('URE_Admin_Notice') ) {
25
  require_once( plugin_dir_path( __FILE__ ) .'includes/classes/admin-notice.php' );
26
  }
29
  return;
30
  }
31
 
32
+ define( 'URE_VERSION', '4.63' );
33
  define( 'URE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
34
  define( 'URE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
35
  define( 'URE_PLUGIN_BASE_NAME', plugin_basename( __FILE__ ) );