User Role Editor - Version 4.58.3

Version Description

Download this release

Release Info

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

Code changes from version 4.58.2 to 4.58.3

changelog.txt CHANGED
@@ -1,5 +1,10 @@
1
  CHANGES LOG (full version).
2
  ===========================
 
 
 
 
 
3
  = [4.58.2] 15.01.2021 =
4
  * Fix: Additional options turned ON for a role was not saved during role update.
5
  * Update: All JavaScript files are loaded with URE plugin version number as a query string for cache busting purpose.
1
  CHANGES LOG (full version).
2
  ===========================
3
+
4
+ = [4.58.3] 26.02.2021 =
5
+ * Update: URE automatically adds custom taxonomies user capabilities to administrator role before opening "Users->User Role Editor" page.
6
+ * Fix: Role changes were not saved with option "Confirm role update" switched off.
7
+
8
  = [4.58.2] 15.01.2021 =
9
  * Fix: Additional options turned ON for a role was not saved during role update.
10
  * Update: All JavaScript files are loaded with URE plugin version number as a query string for cache busting purpose.
includes/classes/capabilities.php CHANGED
@@ -247,6 +247,30 @@ class URE_Capabilities {
247
  }
248
  // end of add_custom_post_type_caps()
249
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
250
 
251
  /**
252
  * Add capabilities for URE permissions system in case some were excluded from Administrator role
@@ -318,6 +342,7 @@ class URE_Capabilities {
318
  }
319
  $this->add_wordpress_caps( $full_list );
320
  $this->add_custom_post_type_caps( $full_list );
 
321
  $this->add_ure_caps( $full_list );
322
  asort( $full_list );
323
  $full_list = apply_filters('ure_full_capabilites', $full_list);
247
  }
248
  // end of add_custom_post_type_caps()
249
 
250
+
251
+ protected function add_custom_taxonomies_caps( &$full_list ) {
252
+
253
+ $taxonomies = $this->lib->get_custom_taxonomies( 'objects' );
254
+ if ( empty( $taxonomies ) ) {
255
+ return;
256
+ }
257
+
258
+ $multisite = $this->lib->get( 'multisite' );
259
+ // admin should be capable to edit any taxonomy
260
+ $cpt_editor_roles0 = !$multisite ? array('administrator') : array();
261
+ $caps_to_check = array('manage_terms', 'edit_terms', 'delete_terms', 'assign_terms');
262
+ foreach( $taxonomies as $taxonomy ) {
263
+ $cpt_editor_roles = apply_filters( 'ure_cpt_editor_roles', $cpt_editor_roles0, $taxonomy->name );
264
+ foreach( $caps_to_check as $capability ) {
265
+ $cap_to_check = $taxonomy->cap->$capability;
266
+ $this->add_capability_to_full_caps_list( $cap_to_check, $full_list );
267
+ self::add_cap_to_roles( $cpt_editor_roles, $cap_to_check );
268
+ }
269
+ }
270
+
271
+ }
272
+ // end of add_custom_taxonomies_caps()
273
+
274
 
275
  /**
276
  * Add capabilities for URE permissions system in case some were excluded from Administrator role
342
  }
343
  $this->add_wordpress_caps( $full_list );
344
  $this->add_custom_post_type_caps( $full_list );
345
+ $this->add_custom_taxonomies_caps( $full_list );
346
  $this->add_ure_caps( $full_list );
347
  asort( $full_list );
348
  $full_list = apply_filters('ure_full_capabilites', $full_list);
includes/classes/editor.php CHANGED
@@ -137,6 +137,9 @@ class URE_Editor {
137
  }
138
 
139
  $this->apply_to_all = isset( $_POST['values']['ure_apply_to_all']) ? true : false;
 
 
 
140
 
141
  return true;
142
  }
@@ -247,7 +250,8 @@ class URE_Editor {
247
  // Visual Composer capabilities are excluded from a role update as they may store not boolean values.
248
  protected function restore_visual_composer_caps() {
249
 
250
- if (!isset($this->roles[$this->current_role]) || !is_array($this->roles[$this->current_role]['capabilities'])) {
 
251
  return false;
252
  }
253
 
@@ -274,7 +278,7 @@ class URE_Editor {
274
 
275
  foreach ( $this->full_capabilities as $cap ) {
276
  $cap_id_esc = URE_Capability::escape( $cap['inner'] );
277
- if ( isset( $_POST['values'][$cap_id_esc] ) ) {
278
  $this->capabilities_to_save[ $cap['inner'] ] = true;
279
  }
280
  }
@@ -291,7 +295,7 @@ class URE_Editor {
291
  */
292
  protected function is_full_network_synch() {
293
 
294
- if (is_network_admin()) { // for Pro version
295
  $result = true;
296
  } else {
297
  $result = defined('URE_MULTISITE_DIRECT_UPDATE') && URE_MULTISITE_DIRECT_UPDATE == 1;
@@ -922,6 +926,21 @@ class URE_Editor {
922
  // end of update_role()
923
 
924
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
925
  /**
926
  * process rename role request
927
  *
137
  }
138
 
139
  $this->apply_to_all = isset( $_POST['values']['ure_apply_to_all']) ? true : false;
140
+ if ( empty( $this->apply_to_all ) && isset( $_POST['ure_apply_to_all'] ) ) {
141
+ $this->apply_to_all = true;
142
+ }
143
 
144
  return true;
145
  }
250
  // Visual Composer capabilities are excluded from a role update as they may store not boolean values.
251
  protected function restore_visual_composer_caps() {
252
 
253
+ if ( !isset( $this->roles[$this->current_role] ) ||
254
+ !is_array( $this->roles[$this->current_role]['capabilities'] ) ) {
255
  return false;
256
  }
257
 
278
 
279
  foreach ( $this->full_capabilities as $cap ) {
280
  $cap_id_esc = URE_Capability::escape( $cap['inner'] );
281
+ if ( isset( $_POST['values'][$cap_id_esc] ) || isset( $_POST[$cap_id_esc] ) ) {
282
  $this->capabilities_to_save[ $cap['inner'] ] = true;
283
  }
284
  }
295
  */
296
  protected function is_full_network_synch() {
297
 
298
+ if ( is_network_admin() ) { // for Pro version
299
  $result = true;
300
  } else {
301
  $result = defined('URE_MULTISITE_DIRECT_UPDATE') && URE_MULTISITE_DIRECT_UPDATE == 1;
926
  // end of update_role()
927
 
928
 
929
+ public function update_network() {
930
+
931
+ $this->init0();
932
+ $this->roles = $this->lib->get_user_roles();
933
+ $this->full_capabilities = $this->lib->init_full_capabilities( $this->ure_object );
934
+ if ( isset( $_POST['user_role'] ) ) {
935
+ $this->notification = $this->init_current_role_name();
936
+ }
937
+ $this->prepare_capabilities_to_save();
938
+ $this->notification = $this->permissions_object_update( $this->notification );
939
+
940
+ }
941
+ // end of update_network()
942
+
943
+
944
  /**
945
  * process rename role request
946
  *
includes/classes/lib.php CHANGED
@@ -541,5 +541,20 @@ class URE_Lib extends URE_Base_Lib {
541
  }
542
  // end of get_all_roles()
543
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
544
  }
545
  // end of URE_Lib class
541
  }
542
  // end of get_all_roles()
543
 
544
+ /*
545
+ * Wrapper to get_taxonomies() to get the custom taxonomies list
546
+ */
547
+ public function get_custom_taxonomies( $output='names' ) {
548
+ $args = array(
549
+ 'show_ui'=>true,
550
+ 'public'=>true,
551
+ '_builtin'=>false
552
+ );
553
+ $taxonomies = get_taxonomies( $args, $output );
554
+
555
+ return $taxonomies;
556
+ }
557
+ // end of get_custom_taxonomies()
558
+
559
  }
560
  // end of URE_Lib class
js/ure.js CHANGED
@@ -1014,10 +1014,12 @@ jQuery(function ($) {
1014
  $('#ure_update_role').button({
1015
  label: ure_data.update
1016
  }).on('click', (function () {
1017
- if (ure_data.confirm_role_update == 1) {
1018
- event.preventDefault();
1019
  //ure_confirm(ure_data.confirm_submit, ure_form_submit);
1020
  ure_confirm( ure_data.confirm_submit, ure_main.update_role );
 
 
1021
  }
1022
  }));
1023
 
1014
  $('#ure_update_role').button({
1015
  label: ure_data.update
1016
  }).on('click', (function () {
1017
+ event.preventDefault();
1018
+ if (ure_data.confirm_role_update == 1) {
1019
  //ure_confirm(ure_data.confirm_submit, ure_form_submit);
1020
  ure_confirm( ure_data.confirm_submit, ure_main.update_role );
1021
+ } else {
1022
+ ure_main.update_role();
1023
  }
1024
  }));
1025
 
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: 5.6
7
- Stable tag: 4.58.2
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,11 @@ https://translate.wordpress.org/projects/wp-plugins/user-role-editor/
80
 
81
 
82
  == Changelog =
 
 
 
 
 
83
  = [4.58.2] 15.01.2021 =
84
  * Fix: Additional options turned ON for a role was not saved during role update.
85
  * Update: All JavaScript files are loaded with URE plugin version number as a query string for cache busting purpose.
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: 5.7
7
+ Stable tag: 4.58.3
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
+
84
+ = [4.58.3] 26.02.2021 =
85
+ * Update: URE automatically adds custom taxonomies user capabilities to administrator role before opening "Users->User Role Editor" page.
86
+ * Fix: Role changes were not saved with option "Confirm role update" switched off.
87
+
88
  = [4.58.2] 15.01.2021 =
89
  * Fix: Additional options turned ON for a role was not saved during role update.
90
  * Update: All JavaScript files are loaded with URE plugin version number as a query string for cache busting purpose.
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.58.2
7
  Author: Vladimir Garagulya
8
  Author URI: https://www.role-editor.com
9
  Text Domain: user-role-editor
@@ -11,7 +11,7 @@ Domain Path: /lang/
11
  */
12
 
13
  /*
14
- Copyright 2010-2020 Vladimir Garagulya (email: support@role-editor.com)
15
  */
16
 
17
  if ( ! function_exists( 'get_option' ) ) {
@@ -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.58.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__ ) );
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.58.3
7
  Author: Vladimir Garagulya
8
  Author URI: https://www.role-editor.com
9
  Text Domain: user-role-editor
11
  */
12
 
13
  /*
14
+ Copyright 2010-2021 Vladimir Garagulya (email: support@role-editor.com)
15
  */
16
 
17
  if ( ! function_exists( 'get_option' ) ) {
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.58.3' );
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__ ) );