User Role Editor - Version 4.25.2

Version Description

Download this release

Release Info

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

Code changes from version 4.25.1 to 4.25.2

includes/{class-advertisement.php → classes/advertisement.php} RENAMED
@@ -8,7 +8,7 @@
8
  *
9
  */
10
 
11
- class ure_Advertisement {
12
 
13
  private $slots = array(0=>'', 1=>'', 2=>'');
14
 
8
  *
9
  */
10
 
11
+ class URE_Advertisement {
12
 
13
  private $slots = array(0=>'', 1=>'', 2=>'');
14
 
includes/{class-ajax-processor.php → classes/ajax-processor.php} RENAMED
File without changes
includes/{class-assign-role.php → classes/assign-role.php} RENAMED
@@ -61,9 +61,13 @@ class URE_Assign_Role {
61
 
62
  global $wpdb;
63
 
64
- $where = $this->get_where_condition();
65
- $query = "select count(ID) from {$wpdb->users} users {$where}";
66
- $users_quant = $wpdb->get_var($query);
 
 
 
 
67
 
68
  return $users_quant;
69
  }
@@ -75,8 +79,6 @@ class URE_Assign_Role {
75
  global $wpdb;
76
 
77
  $top_limit = self::MAX_USERS_TO_PROCESS;
78
- $id = get_current_blog_id();
79
- $blog_prefix = $wpdb->get_blog_prefix($id);
80
  $where = $this->get_where_condition();
81
  $query = "select ID from {$wpdb->users} users
82
  {$where}
61
 
62
  global $wpdb;
63
 
64
+ $users_quant = get_transient('ure_users_without_role');
65
+ if (empty($users_quant)) {
66
+ $where = $this->get_where_condition();
67
+ $query = "select count(ID) from {$wpdb->users} users {$where}";
68
+ $users_quant = $wpdb->get_var($query);
69
+ set_transient('ure_users_without_role', $users_quant, 15);
70
+ }
71
 
72
  return $users_quant;
73
  }
79
  global $wpdb;
80
 
81
  $top_limit = self::MAX_USERS_TO_PROCESS;
 
 
82
  $where = $this->get_where_condition();
83
  $query = "select ID from {$wpdb->users} users
84
  {$where}
includes/{class-known-js-css-compatibility-issues.php → classes/known-js-css-compatibility-issues.php} RENAMED
File without changes
includes/{class-protect-admin.php → classes/protect-admin.php} RENAMED
File without changes
includes/{class-role-additional-options.php → classes/role-additional-options.php} RENAMED
File without changes
includes/{class-ure-screen-help.php → classes/screen-help.php} RENAMED
File without changes
includes/classes/ure-lib.php CHANGED
@@ -27,7 +27,7 @@ class Ure_Lib extends URE_Base_Lib {
27
  protected $caps_readable = false;
28
  protected $hide_pro_banner = false;
29
  protected $full_capabilities = false;
30
- public $ure_object = 'role'; // what to process, 'role' or 'user'
31
  public $role_default_html = '';
32
  protected $role_to_copy_html = '';
33
  protected $role_select_html = '';
@@ -284,7 +284,7 @@ class Ure_Lib extends URE_Base_Lib {
284
  protected function advertisement() {
285
 
286
  if (!$this->is_pro()) {
287
- $this->advert = new ure_Advertisement();
288
  $this->advert->display();
289
  }
290
  }
@@ -683,7 +683,7 @@ if ($this->multisite && !is_network_admin()) {
683
  }
684
 
685
  if (!$this->is_pro()) {
686
- require_once(URE_PLUGIN_DIR . 'includes/class-advertisement.php');
687
  }
688
 
689
  }
@@ -1656,6 +1656,21 @@ if ($this->multisite && !is_network_admin()) {
1656
  // end of add_wordpress_caps()
1657
 
1658
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1659
  protected function add_custom_post_type_caps() {
1660
 
1661
  global $wp_roles;
@@ -1674,14 +1689,18 @@ if ($this->multisite && !is_network_admin()) {
1674
  'delete_others_posts'
1675
  );
1676
 
1677
- $post_types = get_post_types(array('_builtin'=>false), 'objects');
 
1678
  // do not forget attachment post type as it may use the own capabilities set
1679
  $attachment_post_type = get_post_type_object('attachment');
1680
  if ($attachment_post_type->cap->edit_posts!=='edit_posts') {
1681
  $post_types['attachment'] = $attachment_post_type;
1682
  }
1683
 
1684
- foreach($post_types as $post_type) {
 
 
 
1685
  if (!isset($post_type->cap)) {
1686
  continue;
1687
  }
@@ -2437,6 +2456,7 @@ if ($this->multisite && !is_network_admin()) {
2437
  }
2438
  }
2439
  $user->update_user_level_from_caps();
 
2440
 
2441
  if ($this->apply_to_all) { // apply update to the all network
2442
  if (!$this->network_update_user($user)) {
27
  protected $caps_readable = false;
28
  protected $hide_pro_banner = false;
29
  protected $full_capabilities = false;
30
+ public $ure_object = 'role'; // what to process, 'role' or 'user'
31
  public $role_default_html = '';
32
  protected $role_to_copy_html = '';
33
  protected $role_select_html = '';
284
  protected function advertisement() {
285
 
286
  if (!$this->is_pro()) {
287
+ $this->advert = new URE_Advertisement();
288
  $this->advert->display();
289
  }
290
  }
683
  }
684
 
685
  if (!$this->is_pro()) {
686
+ require_once(URE_PLUGIN_DIR . 'includes/classes/advertisement.php');
687
  }
688
 
689
  }
1656
  // end of add_wordpress_caps()
1657
 
1658
 
1659
+ /**
1660
+ * Return all available post types except non-public WordPress built-in post types
1661
+ *
1662
+ * @return array
1663
+ */
1664
+ public function _get_post_types() {
1665
+ $all_post_types = get_post_types();
1666
+ $internal_post_types = get_post_types(array('public'=>false, '_builtin'=>true));
1667
+ $post_types = array_diff($all_post_types, $internal_post_types);
1668
+
1669
+ return $post_types;
1670
+ }
1671
+ // end of get_post_types()
1672
+
1673
+
1674
  protected function add_custom_post_type_caps() {
1675
 
1676
  global $wp_roles;
1689
  'delete_others_posts'
1690
  );
1691
 
1692
+ $post_types = get_post_types(array(), 'objects');
1693
+ $_post_types = $this->_get_post_types();
1694
  // do not forget attachment post type as it may use the own capabilities set
1695
  $attachment_post_type = get_post_type_object('attachment');
1696
  if ($attachment_post_type->cap->edit_posts!=='edit_posts') {
1697
  $post_types['attachment'] = $attachment_post_type;
1698
  }
1699
 
1700
+ foreach($post_types as $post_type) {
1701
+ if (!isset($_post_types[$post_type->name])) {
1702
+ continue;
1703
+ }
1704
  if (!isset($post_type->cap)) {
1705
  continue;
1706
  }
2456
  }
2457
  }
2458
  $user->update_user_level_from_caps();
2459
+ do_action('profile_update', $user->ID, $user); // in order other plugins may hook to the user permissions update
2460
 
2461
  if ($this->apply_to_all) { // apply update to the all network
2462
  if (!$this->network_update_user($user)) {
includes/{class-user-other-roles.php → classes/user-other-roles.php} RENAMED
File without changes
includes/{class-user-role-editor.php → classes/user-role-editor.php} RENAMED
File without changes
includes/loader.php CHANGED
@@ -12,12 +12,12 @@ require_once(URE_PLUGIN_DIR .'includes/define-constants.php');
12
  require_once(URE_PLUGIN_DIR .'includes/misc-support-stuff.php');
13
  require_once(URE_PLUGIN_DIR .'includes/classes/task-queue.php');
14
  require_once(URE_PLUGIN_DIR .'includes/classes/bbpress.php');
15
- require_once(URE_PLUGIN_DIR .'includes/class-assign-role.php');
16
- require_once(URE_PLUGIN_DIR .'includes/class-user-other-roles.php');
17
- require_once(URE_PLUGIN_DIR .'includes/class-protect-admin.php');
18
- require_once(URE_PLUGIN_DIR .'includes/class-ajax-processor.php');
19
- require_once(URE_PLUGIN_DIR .'includes/class-ure-screen-help.php');
20
- require_once(URE_PLUGIN_DIR .'includes/class-known-js-css-compatibility-issues.php');
21
- require_once(URE_PLUGIN_DIR .'includes/class-role-additional-options.php');
22
- require_once(URE_PLUGIN_DIR .'includes/class-user-role-editor.php');
23
 
12
  require_once(URE_PLUGIN_DIR .'includes/misc-support-stuff.php');
13
  require_once(URE_PLUGIN_DIR .'includes/classes/task-queue.php');
14
  require_once(URE_PLUGIN_DIR .'includes/classes/bbpress.php');
15
+ require_once(URE_PLUGIN_DIR .'includes/classes/assign-role.php');
16
+ require_once(URE_PLUGIN_DIR .'includes/classes/user-other-roles.php');
17
+ require_once(URE_PLUGIN_DIR .'includes/classes/protect-admin.php');
18
+ require_once(URE_PLUGIN_DIR .'includes/classes/ajax-processor.php');
19
+ require_once(URE_PLUGIN_DIR .'includes/classes/screen-help.php');
20
+ require_once(URE_PLUGIN_DIR .'includes/classes/known-js-css-compatibility-issues.php');
21
+ require_once(URE_PLUGIN_DIR .'includes/classes/role-additional-options.php');
22
+ require_once(URE_PLUGIN_DIR .'includes/classes/user-role-editor.php');
23
 
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.5
7
- Stable tag: 4.25.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -77,6 +77,12 @@ https://translate.wordpress.org/projects/wp-plugins/user-role-editor/
77
 
78
  == Changelog ==
79
 
 
 
 
 
 
 
80
  = [4.25.1] 15.04.2016 =
81
  * Fix: Selected role's capabilities list was returned back to old after click "Update" button. It was showed correctly according to the recent updates just after additional page refresh.
82
  * Update: deprecated function get_current_user_info() call was replaced with wp_get_current_user().
@@ -115,71 +121,6 @@ https://translate.wordpress.org/projects/wp-plugins/user-role-editor/
115
  * Self-added "Other Roles" column removed from "Users" list, as WordPress started to show all roles assigned to the user in its own "Role" column.
116
  * 'ure_show_additional_capabilities_section' filter allows to hide 'Other Roles' section at the 'Add new user', 'Edit user' pages.
117
 
118
- = [4.21.1] 16.12.2015 =
119
- * Fix: 'Update' button did not work at User's Capabilities page due to confirmation dialog call error.
120
-
121
-
122
- = [4.21] 11.12.2015 =
123
- * It's possible to switch off the update role confirmation (Settings - User Role Editor - General tab).
124
- * Standard JavaScript confirm box before role update was replaced with custom one to exclude 'Prevent this page from creating additional dialogs' option in the Google Chrome browser.
125
- * Fix: Removed hard coded folder name (user-role-editor) from the used paths.
126
-
127
-
128
- = [4.20.1] 15.11.2015 =
129
- * Fix: "Primary default role" drop-down menu was not shown at "Settings - User Role Editor - Default Roles" tab for WordPress single site installation.
130
-
131
- = [4.20] 15.11.2015 =
132
- * "Additional options" section was added to the user role editor page. Currently it contains the only "Hide admin bar". The list of options may be customized/extended by developers via "ure_role_additonal_options" filter.
133
- * "Default Role" button is hidden to not duplicate functionality. Use "Settings - User Role Editor - Default Roles" tab instead. This button is available only for the single sites of WP multisite now.
134
- * Code restructure, optimization: administrator protection parts extracted to the separate class.
135
-
136
- = [4.19.3] 14.10.2015 =
137
- * Fix: minor CSS change.
138
- * Automatically add all available custom post types capabilities to the administrator role under the single site environment. Custom posts types selection query updated to include all custom post types except 'built-in' when adding custom capabilities for them
139
- * Special flag was set to indicate that single site administrator gets raised (superadmin) permissions temporary especially for the 'user-new.php' page, but current user is not the superadmin really.
140
- (This temporary permissions raising is done to allow single site administrator to add new users under multisite if related option is active.)
141
-
142
- = [4.19.2] 01.10.2015 =
143
- * Fix: multiple default roles assignment did not work under the multisite environment, when user was created from front-end by WooCommerce, etc.
144
- * Update: the translation text domain was changed to the plugin slug (user-role-editor) for the compatibility with translations.wordpress.org
145
- * Update: CSS enhanced to exclude column wrapping for the capabilities with the long names.
146
-
147
- = [4.19.1] 20.08.2015 =
148
- * Default role value has not been refreshed automatically after change at the "Default Role" dialog - fixed.
149
- * More detailed notice messages are shown after default role change - to reflect a possible error or problem.
150
- * Other default roles (in addition to the primary role) has been assigned to a new registered user for requests from the admin back-end only. Now this feature works for the requests from the front-end user registration forms too.
151
-
152
- = 4.19 =
153
- * 28.07.2015
154
- * It is possible to assign to the user multiple roles directly through a user profile edit page.
155
- * Custom SQL-query (checked if the role is in use and slow on the huge data) was excluded and replaced with WordPress built-in function call. [Thanks to Aaron](https://wordpress.org/support/topic/poorly-scaling-queries).
156
- * Bulk role assignment to the users without role was rewritten for cases with a huge quant of users. It processes just 50 users without role for the one request to return the answer from the server in the short time. The related code was extracted to the separate class.
157
- * Code to fix JavaScript and CSS compatibility issues introduced by other plugins and themes, which load its stuff globally, was extracted into the separate class.
158
- * Custom filters were added: 'ure_full_capabilites' - takes 1 input parameter, array with a full list of user capabilities visible at URE, 'ure_built_in_wp_caps' - takes 1 input parameter, array with a list of WordPress core user capabilities. These filters may be useful if you give access to the URE for some not administrator user, and wish to change the list of capabilities which are available to him at URE.
159
- * Dutch translation was updated. Thanks to Gerhard Hoogterp.
160
-
161
- = 4.18.4 =
162
- * 30.04.2015
163
- * Calls to the function add_query_arg() is properly escaped with esc_url_raw() to exclude potential XSS vulnerabilities. Nothing critical: both calls of add_query_arg() are placed at the unused sections of the code.
164
- * Italian translation was updated. Thanks to Leo.
165
-
166
- = 4.18.3 =
167
- * 24.02.2015
168
- * Fixed PHP fatal error for roles reset operation.
169
- * Fixed current user capability checking before URE Options page open.
170
- * 3 missed phrases were added to the translations files. Thanks to [Morteza](https://wordpress.org/support/profile/mo0orteza)
171
- * Hebrew translation updated. Thanks to [atar4u](http://atar4u.com)
172
- * Persian translation updated. Thanks to [Morteza](https://wordpress.org/support/profile/mo0orteza)
173
-
174
- = 4.18.2 =
175
- * 06.02.2015
176
- * New option "Edit user capabilities" was added. If it is unchecked - capabilities section of selected user will be shown in the readonly mode. Administrator (except superadmin for multisite) can not assign capabilities to the user directly. He should make it using roles only.
177
- * More universal checking applied to the custom post type capabilities creation to exclude not existing property notices.
178
- * Multisite: URE's options page is prohibited by 'manage_network_users' capability instead of 'ure_manage_options' in case single site administrators does not have permission to use URE.
179
- * URE protects administrator user from editing by other users by default. If you wish to turn off such protection, you may add filter 'ure_supress_administrators_protection' and return 'true' from it.
180
- * Plugin installation to the WordPress multisite with large (thousands) subsites had a problem with script execution time. Fixed. URE does not try to update all subsites at once now. It does it for every subsite separately, only when you visit that subsite.
181
- * Fixed JavaScript bug with 'Reset Roles' for FireFox v.34.
182
-
183
 
184
  Click [here](https://www.role-editor.com/changelog)</a> to look at [the full list of changes](https://www.role-editor.com/changelog) of User Role Editor plugin.
185
 
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.5.1
7
+ Stable tag: 4.25.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
77
 
78
  == Changelog ==
79
 
80
+ = [4.25.2] 03.05.2016 =
81
+ * Update: Enhanced inner processing of available custom post types list.
82
+ * Update: Uses 15 seconds transient cache in order to not count users without role twice when 'restrict_manage_users' action fires.
83
+ * Update: URE fires action 'profile_update' after direct update of user permissions in order other plugins may catch such change.
84
+ * Update: All URE's PHP classes files renamed and moved to the includes/classes subdirectory
85
+
86
  = [4.25.1] 15.04.2016 =
87
  * Fix: Selected role's capabilities list was returned back to old after click "Update" button. It was showed correctly according to the recent updates just after additional page refresh.
88
  * Update: deprecated function get_current_user_info() call was replaced with wp_get_current_user().
121
  * Self-added "Other Roles" column removed from "Users" list, as WordPress started to show all roles assigned to the user in its own "Role" column.
122
  * 'ure_show_additional_capabilities_section' filter allows to hide 'Other Roles' section at the 'Add new user', 'Edit user' pages.
123
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
 
125
  Click [here](https://www.role-editor.com/changelog)</a> to look at [the full list of changes](https://www.role-editor.com/changelog) of User Role Editor plugin.
126
 
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.25.1
7
  Author: Vladimir Garagulya
8
  Author URI: https://www.role-editor.com
9
  Text Domain: ure
@@ -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.25.1');
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__));
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.25.2
7
  Author: Vladimir Garagulya
8
  Author URI: https://www.role-editor.com
9
  Text Domain: ure
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.25.2');
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__));