Capability Manager Enhanced - Version 1.4.3

Version Description

  • Fixed : Separate checkbox was displayed for cap->edit_published_posts even if it was defined to the be same as cap->edit_posts
    • Press Permit integration: automatically store a backup copy of each role's last saved capability set so they can be reinstated if necessary (currently for bbPress)
Download this release

Release Info

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

Code changes from version 1.4.2 to 1.4.3

Files changed (4) hide show
  1. capsman-enhanced.php +3 -3
  2. includes/admin.php +20 -14
  3. includes/manager.php +7 -0
  4. readme.txt +7 -3
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.2
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.2' );
36
- define( 'CAPSMAN_ENH_VERSION', '1.4.2' );
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.3
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.3' );
36
+ define( 'CAPSMAN_ENH_VERSION', '1.4.3' );
37
}
38
39
if ( cme_is_plugin_active( 'capsman.php' ) ) {
includes/admin.php CHANGED
@@ -270,22 +270,28 @@ if( defined('PP_VERSION') ) {
270
if ( ! empty($type_obj->cap->$prop) && ( in_array( $type_obj->name, array( 'post', 'page' ) )
271
|| ! in_array( $type_obj->cap->$prop, $default_caps )
272
|| ( ( 'manage_categories' == $type_obj->cap->$prop ) && ( 'manage_terms' == $prop ) && ( 'category' == $type_obj->name ) ) ) ) {
273
- $cap_name = $type_obj->cap->$prop;
274
275
- if ( $is_administrator || current_user_can($cap_name) ) {
276
- if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
277
- $title_text = sprintf( __( '%s: assigned by Permit Group', 'pp' ), $cap_name );
278
- $disabled = 'disabled="disabled"';
279
- $checked = ' checked="checked"';
280
- } else {
281
- $title_text = $cap_name;
282
- $disabled = '';
283
- $checked = checked(1, ! empty($rcaps[$cap_name]), false );
284
- }
285
286
- $row .= '<input id=caps[' . $cap_name . '] type="checkbox" title="' . $title_text . '" name="caps[' . $cap_name . ']" value="1" ' . $checked . $disabled . ' />';
287
- $type_caps [$cap_name] = true;
288
- $display_row = true;
289
}
290
}
291
$row .= '</td>';
270
if ( ! empty($type_obj->cap->$prop) && ( in_array( $type_obj->name, array( 'post', 'page' ) )
271
|| ! in_array( $type_obj->cap->$prop, $default_caps )
272
|| ( ( 'manage_categories' == $type_obj->cap->$prop ) && ( 'manage_terms' == $prop ) && ( 'category' == $type_obj->name ) ) ) ) {
273
274
+ // if edit_published or edit_private cap is same as edit_posts cap, don't display a checkbox for it
275
+ if ( ( ! in_array( $prop, array( 'edit_published_posts', 'edit_private_posts' ) ) || ( $type_obj->cap->$prop != $type_obj->cap->edit_posts ) )
276
+ && ( ! in_array( $prop, array( 'delete_published_posts', 'delete_private_posts' ) ) || ( $type_obj->cap->$prop != $type_obj->cap->delete_posts ) )
277
+ ) {
278
+ $cap_name = $type_obj->cap->$prop;
279
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;
294
+ }
295
}
296
}
297
$row .= '</td>';
includes/manager.php CHANGED
@@ -357,6 +357,13 @@ class CapabilityManager extends akPluginAbstract
357
$this->saveRoleCapabilities($post['current'], $post['caps'], $post['level']);
358
$this->current = $post['current'];
359
360
// Select a new role.
361
if ( isset($post['Load']) && __('Load', $this->ID) == $post['Load'] ) {
362
$this->current = $post['role'];
357
$this->saveRoleCapabilities($post['current'], $post['caps'], $post['level']);
358
$this->current = $post['current'];
359
360
+ if ( defined( 'PP_VERSION' ) ) { // log customized role caps for subsequent restoration
361
+ $plugins = get_option('active_plugins');
362
+ $customized_roles = (array) pp_get_option( 'customized_roles' );
363
+ $customized_roles[$post['role']] = (object) array( 'caps' => $post['caps'], 'plugins' => $plugins );
364
+ pp_update_option( 'customized_roles', $customized_roles );
365
+ }
366
+
367
// Select a new role.
368
if ( isset($post['Load']) && __('Load', $this->ID) == $post['Load'] ) {
369
$this->current = $post['role'];
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
=== Capability Manager Enhanced===
2
Contributors: txanny, kevinB
3
Help link: http://wordpress.org/tags/capsman-enhanced
4
- Tags: roles, capabilities, manager, rights, role, capability, types, taxonomies
5
- Requires at least: 2.9
6
Tested up to: 3.4.1
7
Stable tag: trunk
8
@@ -96,6 +96,10 @@ You should have received a copy of the GNU General Public License along with thi
96
97
== Changelog ==
98
99
= 1.4.2 =
100
* Language: updated .pot file
101
* Press Permit integration: roles can be marked for supplemental assignment only (and suppressed from WP role assignment dropdown, requires PP 1.0-beta1.4)
@@ -109,7 +113,7 @@ You should have received a copy of the GNU General Public License along with thi
109
* Editing UI separates WP core capabilities and 3rd party capabilities
110
* Clarified sidebar captions
111
* Don't allow a non-Administrator to add or remove a capability they don't have
112
- * Fixed PHP Warnings for unchecked capabilities
113
* Press Permit integration: externally (dis)enable Post Types, Taxonomies for PP filtering (which forces type-specific capability definitions)
114
* Show capabilities which Press Permit adds to the role by supplemental type-specific role assignment
115
* Reduce memory usage by loading framework and plugin code only when needed
1
=== Capability Manager Enhanced===
2
Contributors: txanny, kevinB
3
Help link: http://wordpress.org/tags/capsman-enhanced
4
+ Tags: roles, capabilities, manager, editor, rights, role, capability, types, taxonomies
5
+ Requires at least: 3.1
6
Tested up to: 3.4.1
7
Stable tag: trunk
8
96
97
== Changelog ==
98
99
+ = 1.4.3 =
100
+ * Fixed : Separate checkbox was displayed for cap->edit_published_posts even if it was defined to the be same as cap->edit_posts
101
+ * Press Permit integration: automatically store a backup copy of each role's last saved capability set so they can be reinstated if necessary (currently for bbPress)
102
+
103
= 1.4.2 =
104
* Language: updated .pot file
105
* Press Permit integration: roles can be marked for supplemental assignment only (and suppressed from WP role assignment dropdown, requires PP 1.0-beta1.4)
113
* Editing UI separates WP core capabilities and 3rd party capabilities
114
* Clarified sidebar captions
115
* Don't allow a non-Administrator to add or remove a capability they don't have
116
+ * Fixed : PHP Warnings for unchecked capabilities
117
* Press Permit integration: externally (dis)enable Post Types, Taxonomies for PP filtering (which forces type-specific capability definitions)
118
* Show capabilities which Press Permit adds to the role by supplemental type-specific role assignment
119
* Reduce memory usage by loading framework and plugin code only when needed