Capability Manager Enhanced - Version 1.7.5

Version Description

  • 24 May 2019 =
    • Fixed : Users' inclusion or non-inclusion in Authors dropdown was not updated based on role edit (non-zero level setting)
Download this release

Release Info

Developer kevinB
Plugin Icon 128x128 Capability Manager Enhanced
Version 1.7.5
Comparing to
See all releases

Code changes from version 1.7.4 to 1.7.5

Files changed (3) hide show
  1. capsman-enhanced.php +4 -4
  2. includes/manager.php +22 -0
  3. readme.txt +4 -1
capsman-enhanced.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Capability Manager Enhanced
4
  * Plugin URI: https://publishpress.com
5
  * Description: Manage WordPress role definitions, per-site or network-wide. Organizes post capabilities by post type and operation.
6
- * Version: 1.7.4
7
  * Author: PublishPress
8
  * Author URI: https://publishpress.com
9
  * Text Domain: capsman-enhanced
@@ -23,12 +23,12 @@
23
  * @copyright Copyright (C) 2009, 2010 Jordi Canals; modifications Copyright (C) 2019 PublishPress
24
  * @license GNU General Public License version 3
25
  * @link https://publishpress.com
26
- * @version 1.7.4
27
  */
28
 
29
  if ( ! defined( 'CAPSMAN_VERSION' ) ) {
30
- define( 'CAPSMAN_VERSION', '1.7.4' );
31
- define( 'CAPSMAN_ENH_VERSION', '1.7.4' );
32
  }
33
 
34
  if ( cme_is_plugin_active( 'capsman.php' ) ) {
3
  * Plugin Name: Capability Manager Enhanced
4
  * Plugin URI: https://publishpress.com
5
  * Description: Manage WordPress role definitions, per-site or network-wide. Organizes post capabilities by post type and operation.
6
+ * Version: 1.7.5
7
  * Author: PublishPress
8
  * Author URI: https://publishpress.com
9
  * Text Domain: capsman-enhanced
23
  * @copyright Copyright (C) 2009, 2010 Jordi Canals; modifications Copyright (C) 2019 PublishPress
24
  * @license GNU General Public License version 3
25
  * @link https://publishpress.com
26
+ * @version 1.7.5
27
  */
28
 
29
  if ( ! defined( 'CAPSMAN_VERSION' ) ) {
30
+ define( 'CAPSMAN_VERSION', '1.7.5' );
31
+ define( 'CAPSMAN_ENH_VERSION', '1.7.5' );
32
  }
33
 
34
  if ( cme_is_plugin_active( 'capsman.php' ) ) {
includes/manager.php CHANGED
@@ -364,7 +364,29 @@ class CapabilityManager
364
 
365
  if ( ! empty($_REQUEST['current']) ) { // don't process role update unless form variable is received
366
  check_admin_referer('capsman-general-manager');
 
 
 
 
367
  $this->processAdminGeneral();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
368
  }
369
  }
370
  }
364
 
365
  if ( ! empty($_REQUEST['current']) ) { // don't process role update unless form variable is received
366
  check_admin_referer('capsman-general-manager');
367
+
368
+ $role = get_role($_REQUEST['current']);
369
+ $current_level = ($role) ? ak_caps2level($role->capabilities) : 0;
370
+
371
  $this->processAdminGeneral();
372
+
373
+ $set_level = (isset($_POST['level'])) ? $_POST['level'] : 0;
374
+
375
+ if ($set_level != $current_level) {
376
+ global $wp_roles, $wp_version;
377
+
378
+ if ( version_compare($wp_version, '4.9', '>=') ) {
379
+ $wp_roles->for_site();
380
+ } else {
381
+ $wp_roles->reinit();
382
+ }
383
+
384
+ foreach( get_users(array('role' => $_REQUEST['current'], 'fields' => 'ID')) as $ID ) {
385
+ $user = new WP_User($ID);
386
+ $user->get_role_caps();
387
+ $user->update_user_level_from_caps();
388
+ }
389
+ }
390
  }
391
  }
392
  }
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: publishpress, kevinB, stevejburge, andergmartins
3
  Tags: role, capabilities, post types, taxonomies, editor, network, multisite
4
  Requires at least: 4.1
5
  Tested up to: 5.2
6
- Stable tag: 1.7.4
7
  License: GPLv3
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -70,6 +70,9 @@ Keep in mind that this plugin's main purpose is to expose switches (defined capa
70
 
71
  == Changelog ==
72
 
 
 
 
73
  = 1.7.4 - 1 May 2019 =
74
  * Fixed : On some sites, capabilities added dynamically by other code were forced into stored role definition (and could not be removed).
75
  * Fixed : Negative role capabilities could not be directly unset (had to be checked, saved, then unchecked).
3
  Tags: role, capabilities, post types, taxonomies, editor, network, multisite
4
  Requires at least: 4.1
5
  Tested up to: 5.2
6
+ Stable tag: 1.7.5
7
  License: GPLv3
8
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
 
70
 
71
  == Changelog ==
72
 
73
+ = 1.7.5 - 24 May 2019 =
74
+ * Fixed : Users' inclusion or non-inclusion in Authors dropdown was not updated based on role edit (non-zero level setting)
75
+
76
  = 1.7.4 - 1 May 2019 =
77
  * Fixed : On some sites, capabilities added dynamically by other code were forced into stored role definition (and could not be removed).
78
  * Fixed : Negative role capabilities could not be directly unset (had to be checked, saved, then unchecked).