User Role Editor - Version 4.44

Version Description

Download this release

Release Info

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

Code changes from version 4.43 to 4.44

includes/classes/protect-admin.php CHANGED
@@ -116,7 +116,14 @@ class URE_Protect_Admin {
116
  * @return array
117
  */
118
  public function not_edit_admin($allcaps, $caps, $name) {
119
- $cap = (is_array($caps) & count($caps)>0) ? $caps[0] : $caps;
 
 
 
 
 
 
 
120
  $checked_caps = array('edit_users', 'delete_users', 'remove_users');
121
  if (!in_array($cap, $checked_caps)) {
122
  return $allcaps;
116
  * @return array
117
  */
118
  public function not_edit_admin($allcaps, $caps, $name) {
119
+
120
+ if (is_array($caps) & count($caps)>0) {
121
+ // 1st element of this array not always has index 0. Use workaround to extract it.
122
+ $caps_v = array_values($caps);
123
+ $cap = $caps_v[0];
124
+ } else {
125
+ $cap = $caps;
126
+ }
127
  $checked_caps = array('edit_users', 'delete_users', 'remove_users');
128
  if (!in_array($cap, $checked_caps)) {
129
  return $allcaps;
includes/classes/role-additional-options.php CHANGED
@@ -62,11 +62,7 @@ class URE_Role_Additional_Options {
62
 
63
 
64
  public function set_active_items_hooks() {
65
-
66
- if (current_user_can('ure_edit_roles')) {
67
- return;
68
- }
69
-
70
  $current_user = wp_get_current_user();
71
  foreach($current_user->roles as $role) {
72
  if (!isset($this->active_items[$role])) {
62
 
63
 
64
  public function set_active_items_hooks() {
65
+
 
 
 
 
66
  $current_user = wp_get_current_user();
67
  foreach($current_user->roles as $role) {
68
  if (!isset($this->active_items[$role])) {
includes/classes/ure-lib.php CHANGED
@@ -1793,9 +1793,7 @@ class URE_Lib extends URE_Base_Lib {
1793
  }
1794
  }
1795
  }
1796
-
1797
-
1798
-
1799
  // add individual capabilities to user
1800
  if (count($this->capabilities_to_save) > 0) {
1801
  foreach ($this->capabilities_to_save as $key => $value) {
@@ -1803,8 +1801,9 @@ class URE_Lib extends URE_Base_Lib {
1803
  }
1804
  }
1805
  $user->update_user_level_from_caps();
1806
- do_action('profile_update', $user->ID, $user); // in order other plugins may hook to the user permissions update
1807
-
 
1808
  if ($this->apply_to_all) { // apply update to the all network
1809
  if (!$this->network_update_user($user)) {
1810
  return false;
1793
  }
1794
  }
1795
  }
1796
+
 
 
1797
  // add individual capabilities to user
1798
  if (count($this->capabilities_to_save) > 0) {
1799
  foreach ($this->capabilities_to_save as $key => $value) {
1801
  }
1802
  }
1803
  $user->update_user_level_from_caps();
1804
+
1805
+ do_action('ure_user_permissions_update', $user->ID, $user); // in order other plugins may hook to the user permissions update
1806
+
1807
  if ($this->apply_to_all) { // apply update to the all network
1808
  if (!$this->network_update_user($user)) {
1809
  return false;
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: shinephp
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=vladimir%40shinephp%2ecom&lc=RU&item_name=ShinePHP%2ecom&item_number=User%20Role%20Editor%20WordPress%20plugin&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
4
  Tags: user, role, editor, security, access, permission, capability
5
  Requires at least: 4.0
6
- Tested up to: 4.9.6
7
- Stable tag: 4.43
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -79,6 +79,13 @@ https://translate.wordpress.org/projects/wp-plugins/user-role-editor/
79
 
80
 
81
  == Changelog =
 
 
 
 
 
 
 
82
  = [4.43] 05.06.2018 =
83
  * Update: references to non-existed roles are removed from the URE role additional options data storage after any role update.
84
  * Fix: Additional options section view for the current role was not refreshed properly after other current role selection.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=vladimir%40shinephp%2ecom&lc=RU&item_name=ShinePHP%2ecom&item_number=User%20Role%20Editor%20WordPress%20plugin&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
4
  Tags: user, role, editor, security, access, permission, capability
5
  Requires at least: 4.0
6
+ Tested up to: 4.9.7
7
+ Stable tag: 4.44
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
79
 
80
 
81
  == Changelog =
82
+ = [4.44] 05.07.2018 =
83
+ * Update: URE had executed 'profile_update' action after update of user permissions from the user permissions editor page: Users->selected user->Capabilities.
84
+ It was replaced with 'ure_user_permissions_update' action now. It will allow to exclude conflicts with other plugins - "WP Members" [lost checkbox fields values](https://wordpress.org/support/topic/conflict-with-wp-members-2/), for example.
85
+ * Update: Additional options for role (like "Hide admin bar" at the bottom of URE page) did not applied to the user with 'ure_edit_roles' capability. This conditon was removed.
86
+ * Update: fix PHP notice 'Undefined offset: 0 in ...' at includes/classes/protect-admin.php, not_edit_admin(), where the 1st element of $caps array not always has index 0.
87
+ * Update: PHP required version was increased up to 5.4.
88
+
89
  = [4.43] 05.06.2018 =
90
  * Update: references to non-existed roles are removed from the URE role additional options data storage after any role update.
91
  * Fix: Additional options section view for the current role was not refreshed properly after other current role selection.
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.43
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.43');
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__));
@@ -34,7 +34,7 @@ require_once(URE_PLUGIN_DIR.'includes/classes/base-lib.php');
34
  require_once(URE_PLUGIN_DIR.'includes/classes/ure-lib.php');
35
 
36
  // check PHP version
37
- $ure_required_php_version = '5.3';
38
  $exit_msg = sprintf( 'User Role Editor requires PHP %s or newer.', $ure_required_php_version ) .
39
  '<a href="http://wordpress.org/about/requirements/"> ' . 'Please update!' . '</a>';
40
  URE_Lib::check_version( PHP_VERSION, $ure_required_php_version, $exit_msg, __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.44
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.44');
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__));
34
  require_once(URE_PLUGIN_DIR.'includes/classes/ure-lib.php');
35
 
36
  // check PHP version
37
+ $ure_required_php_version = '5.4';
38
  $exit_msg = sprintf( 'User Role Editor requires PHP %s or newer.', $ure_required_php_version ) .
39
  '<a href="http://wordpress.org/about/requirements/"> ' . 'Please update!' . '</a>';
40
  URE_Lib::check_version( PHP_VERSION, $ure_required_php_version, $exit_msg, __FILE__ );