Capability Manager Enhanced - Version 1.4.5

Version Description

  • Fixed : Capabilities were needlessly re-saved on role load
    • Fixed : Capability labels in "Other WordPress" section did not toggle checkbox selection
    • Press Permit integration: If capability is granted by the role's Permit Group, highlight it as green with a descriptive caption title, but leave checkbox enabled for display/editing of role defintion setting (previous behavior caused capability to be stripped out of WP role definition under some PP configurations)
Download this release

Release Info

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

Code changes from version 1.4.4 to 1.4.5

Files changed (4) hide show
  1. capsman-enhanced.php +3 -3
  2. includes/admin.php +13 -15
  3. includes/manager.php +1 -2
  4. readme.txt +5 -0
capsman-enhanced.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Capability Manager Enhanced
4
Plugin URI: http://presspermit.com/capability-manager
5
Description: Manage WordPress role definitions. Organizes available capabilities by post type, status and source.
6
- Version: 1.4.4
7
Author: Jordi Canals, Kevin Behrens
8
Author URI: http://agapetry.net
9
*/
@@ -32,8 +32,8 @@ Author URI: http://agapetry.net
32
*/
33
34
if ( ! defined( 'CAPSMAN_VERSION' ) ) {
35
- define( 'CAPSMAN_VERSION', '1.4.4' );
36
- define( 'CAPSMAN_ENH_VERSION', '1.4.4' );
37
}
38
39
if ( cme_is_plugin_active( 'capsman.php' ) ) {
3
Plugin Name: Capability Manager Enhanced
4
Plugin URI: http://presspermit.com/capability-manager
5
Description: Manage WordPress role definitions. Organizes available capabilities by post type, status and source.
6
+ Version: 1.4.5
7
Author: Jordi Canals, Kevin Behrens
8
Author URI: http://agapetry.net
9
*/
32
*/
33
34
if ( ! defined( 'CAPSMAN_VERSION' ) ) {
35
+ define( 'CAPSMAN_VERSION', '1.4.5' );
36
+ define( 'CAPSMAN_ENH_VERSION', '1.4.5' );
37
}
38
39
if ( cme_is_plugin_active( 'capsman.php' ) ) {
includes/admin.php CHANGED
@@ -280,14 +280,13 @@ if( defined('PP_VERSION') ) {
280
if ( $is_administrator || current_user_can($cap_name) ) {
281
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
282
$title_text = sprintf( __( '%s: assigned by Permit Group', 'pp' ), $cap_name );
283
- $disabled = 'disabled="disabled"';
284
- $checked = ' checked="checked"';
285
} else {
286
$title_text = $cap_name;
287
- $disabled = '';
288
- $checked = checked(1, ! empty($rcaps[$cap_name]), false );
289
}
290
291
$row .= '<input id=caps[' . $cap_name . '] type="checkbox" title="' . $title_text . '" name="caps[' . $cap_name . ']" value="1" ' . $checked . $disabled . ' />';
292
$type_caps [$cap_name] = true;
293
$display_row = true;
@@ -354,17 +353,18 @@ if( defined('PP_VERSION') ) {
354
355
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
356
$title_text = sprintf( __( '%s: assigned by Permit Group', 'pp' ), $cap_name );
357
- $disabled = 'disabled="disabled"';
358
- $checked = ' checked="checked"';
359
} else {
360
$title_text = $cap_name;
361
- $disabled = '';
362
- $checked = checked(1, ! empty($rcaps[$cap_name]), false );
363
}
364
365
$class = ( ! empty($rcaps[$cap_name]) || ! empty($pp_metagroup_caps[$cap_name]) ) ? 'cap_yes' : 'cap_no';
366
- echo "<td class='$class' title='$title_text'>";
367
- echo ( '<input id=caps[' . $cap_name . '] type="checkbox" name="caps[' . $cap_name . ']" value="1" ' . $checked . $disabled . ' /> ' );
368
echo str_replace( '_', ' ', $cap_name );
369
echo '</td>';
370
$i++;
@@ -398,19 +398,17 @@ if( defined('PP_VERSION') ) {
398
echo '</tr><tr>';
399
$i = 0; $first_row = false;
400
}
401
- //$style = ( ! empty($rcaps[$cap_name]) || ! empty($pp_metagroup_caps[$cap_name]) ) ? 'color:green;font-weight:bold;' : 'color:red;';
402
$class = ( ! empty($rcaps[$cap_name]) || ! empty($pp_metagroup_caps[$cap_name]) ) ? 'cap_yes' : 'cap_no';
403
404
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
405
$title_text = sprintf( __( '%s: assigned by Permit Group', 'pp' ), $cap_name );
406
- $disabled = 'disabled="disabled"';
407
- $checked = ' checked="checked"';
408
} else {
409
$title_text = $cap_name;
410
- $disabled = '';
411
- $checked = checked(1, ! empty($rcaps[$cap_name]), false );
412
}
413
414
if ( 'manage_capabilities' == $cap_name ) {
415
if ( ! current_user_can('administrator') ) {
416
continue;
280
if ( $is_administrator || current_user_can($cap_name) ) {
281
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
282
$title_text = sprintf( __( '%s: assigned by Permit Group', 'pp' ), $cap_name );
283
} else {
284
$title_text = $cap_name;
285
}
286
287
+ $disabled = '';
288
+ $checked = checked(1, ! empty($rcaps[$cap_name]), false );
289
+
290
$row .= '<input id=caps[' . $cap_name . '] type="checkbox" title="' . $title_text . '" name="caps[' . $cap_name . ']" value="1" ' . $checked . $disabled . ' />';
291
$type_caps [$cap_name] = true;
292
$display_row = true;
353
354
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
355
$title_text = sprintf( __( '%s: assigned by Permit Group', 'pp' ), $cap_name );
356
} else {
357
$title_text = $cap_name;
358
}
359
360
+ $disabled = '';
361
+ $checked = checked(1, ! empty($rcaps[$cap_name]), false );
362
+
363
$class = ( ! empty($rcaps[$cap_name]) || ! empty($pp_metagroup_caps[$cap_name]) ) ? 'cap_yes' : 'cap_no';
364
+
365
+ ?>
366
+ <td class="<?php echo $class; ?>"><label for="caps[<?php echo $cap_name; ?>]" title="<?php echo $title_text;?>"><input id=caps[<?php echo $cap_name; ?>] type="checkbox" name="caps[<?php echo $cap_name; ?>]" value="1" <?php echo $checked . $disabled;?> />
367
+ <?php
368
echo str_replace( '_', ' ', $cap_name );
369
echo '</td>';
370
$i++;
398
echo '</tr><tr>';
399
$i = 0; $first_row = false;
400
}
401
$class = ( ! empty($rcaps[$cap_name]) || ! empty($pp_metagroup_caps[$cap_name]) ) ? 'cap_yes' : 'cap_no';
402
403
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
404
$title_text = sprintf( __( '%s: assigned by Permit Group', 'pp' ), $cap_name );
405
} else {
406
$title_text = $cap_name;
407
}
408
409
+ $disabled = '';
410
+ $checked = checked(1, ! empty($rcaps[$cap_name]), false );
411
+
412
if ( 'manage_capabilities' == $cap_name ) {
413
if ( ! current_user_can('administrator') ) {
414
continue;
includes/manager.php CHANGED
@@ -355,7 +355,6 @@ class CapabilityManager extends akPluginAbstract
355
$post['caps'] = array();
356
}
357
358
- $this->saveRoleCapabilities($post['current'], $post['caps'], $post['level']);
359
$this->current = $post['current'];
360
361
if ( defined( 'PP_VERSION' ) ) { // log customized role caps for subsequent restoration
@@ -396,6 +395,7 @@ class CapabilityManager extends akPluginAbstract
396
397
// Save role changes. Already saved at start with self::saveRoleCapabilities().
398
} elseif ( ! empty($post['SaveRole']) ) {
399
ak_admin_notify(__('New capabilities saved.', $this->ID));
400
401
// Create New Capability and adds it to current role.
@@ -693,7 +693,6 @@ class CapabilityManager extends akPluginAbstract
693
* @return void
694
*/
695
private function saveRoleCapabilities( $role_name, $caps, $level ) {
696
-
697
$this->generateNames();
698
$role = get_role($role_name);
699
355
$post['caps'] = array();
356
}
357
358
$this->current = $post['current'];
359
360
if ( defined( 'PP_VERSION' ) ) { // log customized role caps for subsequent restoration
395
396
// Save role changes. Already saved at start with self::saveRoleCapabilities().
397
} elseif ( ! empty($post['SaveRole']) ) {
398
+ $this->saveRoleCapabilities($post['current'], $post['caps'], $post['level']);
399
ak_admin_notify(__('New capabilities saved.', $this->ID));
400
401
// Create New Capability and adds it to current role.
693
* @return void
694
*/
695
private function saveRoleCapabilities( $role_name, $caps, $level ) {
696
$this->generateNames();
697
$role = get_role($role_name);
698
readme.txt CHANGED
@@ -96,6 +96,11 @@ You should have received a copy of the GNU General Public License along with thi
96
97
== Changelog ==
98
99
= 1.4.4 =
100
* Fixed : On translated sites, roles could not be edited
101
* Fixed : Menu item change to "Role Capabilities" broke existing translations
96
97
== Changelog ==
98
99
+ = 1.4.5 =
100
+ * Fixed : Capabilities were needlessly re-saved on role load
101
+ * Fixed : Capability labels in "Other WordPress" section did not toggle checkbox selection
102
+ * Press Permit integration: If capability is granted by the role's Permit Group, highlight it as green with a descriptive caption title, but leave checkbox enabled for display/editing of role defintion setting (previous behavior caused capability to be stripped out of WP role definition under some PP configurations)
103
+
104
= 1.4.4 =
105
* Fixed : On translated sites, roles could not be edited
106
* Fixed : Menu item change to "Role Capabilities" broke existing translations