Capability Manager Enhanced - Version 2.3.4

Version Description

  • 26 Jan 2022 =
    • Compat : WordPress 5.9 - failure adding / editing posts under some Editor Features configurations (work around WP hooking late-defined function disable_block_editor_fornavigation_post_type)
Download this release

Release Info

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

Code changes from version 2.3.3 to 2.3.4

capsman-enhanced.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: PublishPress Capabilities
4
  * Plugin URI: https://publishpress.com/capability-manager/
5
  * Description: Manage WordPress role definitions, per-site or network-wide. Organizes post capabilities by post type and operation.
6
- * Version: 2.3.3
7
  * Author: PublishPress
8
  * Author URI: https://publishpress.com/
9
  * Text Domain: capsman-enhanced
@@ -12,7 +12,7 @@
12
  * Requires PHP: 5.6.20
13
  * License: GPLv3
14
  *
15
- * Copyright (c) 2021 PublishPress
16
  *
17
  * ------------------------------------------------------------------------------
18
  * Based on Capability Manager
@@ -22,16 +22,16 @@
22
  *
23
  * @package capability-manager-enhanced
24
  * @author PublishPress
25
- * @copyright Copyright (C) 2009, 2010 Jordi Canals; modifications Copyright (C) 2020 PublishPress
26
  * @license GNU General Public License version 3
27
  * @link https://publishpress.com/
28
- * @version 2.3.3
29
  */
30
 
31
  if (!defined('CAPSMAN_VERSION')) {
32
- define('CAPSMAN_VERSION', '2.3.3');
33
- define('CAPSMAN_ENH_VERSION', '2.3.3');
34
- define('PUBLISHPRESS_CAPS_VERSION', '2.3.3');
35
  }
36
 
37
  foreach (get_option('active_plugins') as $plugin_file) {
3
  * Plugin Name: PublishPress Capabilities
4
  * Plugin URI: https://publishpress.com/capability-manager/
5
  * Description: Manage WordPress role definitions, per-site or network-wide. Organizes post capabilities by post type and operation.
6
+ * Version: 2.3.4
7
  * Author: PublishPress
8
  * Author URI: https://publishpress.com/
9
  * Text Domain: capsman-enhanced
12
  * Requires PHP: 5.6.20
13
  * License: GPLv3
14
  *
15
+ * Copyright (c) 2022 PublishPress
16
  *
17
  * ------------------------------------------------------------------------------
18
  * Based on Capability Manager
22
  *
23
  * @package capability-manager-enhanced
24
  * @author PublishPress
25
+ * @copyright Copyright (C) 2009, 2010 Jordi Canals; modifications Copyright (C) 2022 PublishPress
26
  * @license GNU General Public License version 3
27
  * @link https://publishpress.com/
28
+ * @version 2.3.4
29
  */
30
 
31
  if (!defined('CAPSMAN_VERSION')) {
32
+ define('CAPSMAN_VERSION', '2.3.4');
33
+ define('CAPSMAN_ENH_VERSION', '2.3.4');
34
+ define('PUBLISHPRESS_CAPS_VERSION', '2.3.4');
35
  }
36
 
37
  foreach (get_option('active_plugins') as $plugin_file) {
includes/admin.php CHANGED
@@ -776,7 +776,7 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
776
  if ( apply_filters( 'pp_caps_lock_capability', true, 'read', $default ) ) {
777
  $lock_capability = true;
778
  $class .= ' cap-locked';
779
- $disabled = 'disabled';
780
  if ( 'administrator' != $this->current ) {
781
  $cap_title = __('Lockout Prevention: To remove read capability, first remove WordPress admin / editing capabilities, or add "dashboard_lockout_ok" capability', 'capsman-enhanced' );
782
  }
@@ -1120,7 +1120,7 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
1120
  } elseif ( 'administrator' == $default ) {
1121
  $class .= ' cap-locked';
1122
  $lock_manage_caps_capability = true;
1123
- $disabled = 'disabled';
1124
  }
1125
  }
1126
  ?>
776
  if ( apply_filters( 'pp_caps_lock_capability', true, 'read', $default ) ) {
777
  $lock_capability = true;
778
  $class .= ' cap-locked';
779
+ $disabled = ' disabled ';
780
  if ( 'administrator' != $this->current ) {
781
  $cap_title = __('Lockout Prevention: To remove read capability, first remove WordPress admin / editing capabilities, or add "dashboard_lockout_ok" capability', 'capsman-enhanced' );
782
  }
1120
  } elseif ( 'administrator' == $default ) {
1121
  $class .= ' cap-locked';
1122
  $lock_manage_caps_capability = true;
1123
+ $disabled = ' disabled ';
1124
  }
1125
  }
1126
  ?>
includes/functions-admin.php CHANGED
@@ -94,7 +94,19 @@ function _pp_capabilities_is_block_editor_active($post_type = '', $args = [])
94
  }
95
  } else {
96
  $use_block = ('block' == get_user_meta($current_user->ID, 'wp_classic-editor-settings'));
97
- return $use_block && apply_filters('use_block_editor_for_post_type', $use_block, $post_type, PHP_INT_MAX);
 
 
 
 
 
 
 
 
 
 
 
 
98
  }
99
  }
100
  }
@@ -115,6 +127,12 @@ function _pp_capabilities_is_block_editor_active($post_type = '', $args = [])
115
  * Classic editor either disabled or enabled (either via an option or with GET argument).
116
  * It's a hairy conditional :(
117
  */
 
 
 
 
 
 
118
  // phpcs:ignore WordPress.VIP.SuperGlobalInputUsage.AccessDetected, WordPress.Security.NonceVerification.NoNonceVerification
119
  $conditions[] = (version_compare($wp_version, '5.0', '>=') || $pluginsState['gutenberg'])
120
  && ! $pluginsState['classic-editor']
@@ -134,6 +152,10 @@ function _pp_capabilities_is_block_editor_active($post_type = '', $args = [])
134
  $conditions[] = $pluginsState['gutenberg-ramp']
135
  && apply_filters('use_block_editor_for_post', true, get_post(pp_capabilities_get_post_id()), PHP_INT_MAX);
136
 
 
 
 
 
137
  // Returns true if at least one condition is true.
138
  $result = count(
139
  array_filter($conditions,
94
  }
95
  } else {
96
  $use_block = ('block' == get_user_meta($current_user->ID, 'wp_classic-editor-settings'));
97
+
98
+ if (version_compare($wp_version, '5.9-beta', '>=')) {
99
+ remove_action('use_block_editor_for_post_type', '_disable_block_editor_for_navigation_post_type', 10, 2);
100
+ remove_filter('use_block_editor_for_post_type', '_disable_block_editor_for_navigation_post_type', 10, 2);
101
+ }
102
+
103
+ $use_block = $use_block && apply_filters('use_block_editor_for_post_type', $use_block, $post_type, PHP_INT_MAX);
104
+
105
+ if (defined('PP_CAPABILITIES_RESTORE_NAV_TYPE_BLOCK_EDITOR_DISABLE') && version_compare($wp_version, '5.9-beta', '>=')) {
106
+ add_filter('use_block_editor_for_post_type', '_disable_block_editor_for_navigation_post_type', 10, 2 );
107
+ }
108
+
109
+ return $use_block;
110
  }
111
  }
112
  }
127
  * Classic editor either disabled or enabled (either via an option or with GET argument).
128
  * It's a hairy conditional :(
129
  */
130
+
131
+ if (version_compare($wp_version, '5.9-beta', '>=')) {
132
+ remove_action('use_block_editor_for_post_type', '_disable_block_editor_for_navigation_post_type', 10, 2);
133
+ remove_filter('use_block_editor_for_post_type', '_disable_block_editor_for_navigation_post_type', 10, 2);
134
+ }
135
+
136
  // phpcs:ignore WordPress.VIP.SuperGlobalInputUsage.AccessDetected, WordPress.Security.NonceVerification.NoNonceVerification
137
  $conditions[] = (version_compare($wp_version, '5.0', '>=') || $pluginsState['gutenberg'])
138
  && ! $pluginsState['classic-editor']
152
  $conditions[] = $pluginsState['gutenberg-ramp']
153
  && apply_filters('use_block_editor_for_post', true, get_post(pp_capabilities_get_post_id()), PHP_INT_MAX);
154
 
155
+ if (defined('PP_CAPABILITIES_RESTORE_NAV_TYPE_BLOCK_EDITOR_DISABLE') && version_compare($wp_version, '5.9-beta', '>=')) {
156
+ add_filter('use_block_editor_for_post_type', '_disable_block_editor_for_navigation_post_type', 10, 2 );
157
+ }
158
+
159
  // Returns true if at least one condition is true.
160
  $result = count(
161
  array_filter($conditions,
includes/handler.php CHANGED
@@ -36,7 +36,7 @@ class CapsmanHandler
36
  }
37
 
38
  // Create a new role.
39
- if ( ! empty($_POST['CreateRole'])) {
40
  if (!empty($_POST['create-name'])) {
41
  $newrole = $this->createRole(sanitize_text_field($_POST['create-name']));
42
  }
36
  }
37
 
38
  // Create a new role.
39
+ if ( ! empty($_POST['CreateRole']) ) {
40
  if (!empty($_POST['create-name'])) {
41
  $newrole = $this->createRole(sanitize_text_field($_POST['create-name']));
42
  }
readme.txt CHANGED
@@ -5,9 +5,9 @@ Author: PublishPress
5
  Author URI: https://publishpress.com
6
  Tags: user roles, capabilities, permissions, admin menus, post editing, post types, taxonomies
7
  Requires at least: 4.9.7
8
- Tested up to: 5.8
9
  Requires PHP: 5.6.20
10
- Stable tag: 2.3.3
11
  License: GPLv3
12
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
13
 
@@ -409,6 +409,9 @@ Fixed : Security issue. Please update.
409
 
410
  == Changelog ==
411
 
 
 
 
412
  = 2.3.3 - 13 Jan 2022 =
413
  * Fixed : Capability names with dashes could not be added
414
  * Fixed : After role rename, title in dropdown does not refresh
5
  Author URI: https://publishpress.com
6
  Tags: user roles, capabilities, permissions, admin menus, post editing, post types, taxonomies
7
  Requires at least: 4.9.7
8
+ Tested up to: 5.9
9
  Requires PHP: 5.6.20
10
+ Stable tag: 2.3.4
11
  License: GPLv3
12
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
13
 
409
 
410
  == Changelog ==
411
 
412
+ = 2.3.4 - 26 Jan 2022 =
413
+ * Compat : WordPress 5.9 - failure adding / editing posts under some Editor Features configurations (work around WP hooking late-defined function _disable_block_editor_for_navigation_post_type)
414
+
415
  = 2.3.3 - 13 Jan 2022 =
416
  * Fixed : Capability names with dashes could not be added
417
  * Fixed : After role rename, title in dropdown does not refresh