Capability Manager Enhanced - Version 1.9.5

Version Description

  • 6 Apr 2020 =
    • Fixed : Fatal error loading Capabilities screen on a small percentage of installations
    • Compat : PublishPress Permissions - Post Type selections for "Type-Specific Capabilities" were not synchronized with PublishPress Permissions under some conditions
Download this release

Release Info

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

Code changes from version 1.9.4 to 1.9.5

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: 1.9.4
7
  * Author: PublishPress
8
  * Author URI: https://publishpress.com/
9
  * Text Domain: capsman-enhanced
@@ -25,13 +25,13 @@
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 1.9.4
29
  */
30
 
31
  if (!defined('CAPSMAN_VERSION')) {
32
- define('CAPSMAN_VERSION', '1.9.4');
33
- define('CAPSMAN_ENH_VERSION', '1.9.4');
34
- define('PUBLISHPRESS_CAPS_VERSION', '1.9.4');
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: 1.9.5
7
  * Author: PublishPress
8
  * Author URI: https://publishpress.com/
9
  * Text Domain: capsman-enhanced
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 1.9.5
29
  */
30
 
31
  if (!defined('CAPSMAN_VERSION')) {
32
+ define('CAPSMAN_VERSION', '1.9.5');
33
+ define('CAPSMAN_ENH_VERSION', '1.9.5');
34
+ define('PUBLISHPRESS_CAPS_VERSION', '1.9.5');
35
  }
36
 
37
  foreach (get_option('active_plugins') as $plugin_file) {
includes/CoreAdmin.php CHANGED
@@ -6,13 +6,12 @@ class CoreAdmin {
6
  add_action('admin_print_scripts', [$this, 'setUpgradeMenuLink'], 50);
7
 
8
  if (is_admin()) {
9
- $autoloadPath = PUBLISHPRESS_CAPS_ABSPATH . '/' . 'vendor' . '/' . 'autoload.php';
10
  if (file_exists($autoloadPath)) {
11
  require_once $autoloadPath;
12
  }
13
 
14
- require_once PUBLISHPRESS_CAPS_ABSPATH . '/' . 'vendor' . '/' . 'publishpress' . '/'
15
- . 'wordpress-version-notices' . '/' . 'includes.php';
16
 
17
  add_filter(\PPVersionNotices\Module\TopNotice\Module::SETTINGS_FILTER, function ($settings) {
18
  $settings['capabilities'] = [
6
  add_action('admin_print_scripts', [$this, 'setUpgradeMenuLink'], 50);
7
 
8
  if (is_admin()) {
9
+ $autoloadPath = PUBLISHPRESS_CAPS_ABSPATH . '/vendor/autoload.php';
10
  if (file_exists($autoloadPath)) {
11
  require_once $autoloadPath;
12
  }
13
 
14
+ require_once PUBLISHPRESS_CAPS_ABSPATH . '/vendor/publishpress/wordpress-version-notices/includes.php';
 
15
 
16
  add_filter(\PPVersionNotices\Module\TopNotice\Module::SETTINGS_FILTER, function ($settings) {
17
  $settings['capabilities'] = [
includes/cap-helper.php CHANGED
@@ -26,7 +26,7 @@ class CME_Cap_Helper {
26
  $this->force_distinct_taxonomy_caps();
27
  }
28
 
29
- function force_distinct_post_caps() { // for selected post types (as stored in option array pp_enabled_post_types)
30
  global $wp_post_types, $wp_roles;
31
 
32
  $core_meta_caps = array_fill_keys( array( 'read_post', 'edit_post', 'delete_post' ), true );
26
  $this->force_distinct_taxonomy_caps();
27
  }
28
 
29
+ function force_distinct_post_caps() { // for selected post types (as stored in option array presspermit_enabled_post_types)
30
  global $wp_post_types, $wp_roles;
31
 
32
  $core_meta_caps = array_fill_keys( array( 'read_post', 'edit_post', 'delete_post' ), true );
includes/filters.php CHANGED
@@ -206,7 +206,7 @@ function _cme_remap_term_meta_cap ( $caps, $cap, $user_id, $args ) {
206
  return $caps;
207
  }
208
 
209
- // Note: this intentionally shares "pp_enabled_post_types" option with Press Permit
210
  function cme_get_assisted_post_types() {
211
  $type_args = array( 'public' => true, 'show_ui' => true );
212
 
@@ -216,7 +216,8 @@ function cme_get_assisted_post_types() {
216
  $post_types = array_diff_key( $types, array_fill_keys( (array) $omit_types, true ) );
217
  }
218
 
219
- $enabled = (array) get_option( 'pp_enabled_post_types', array( 'post' => true, 'page' => true ) );
 
220
  $post_types = array_intersect( $post_types, array_keys( array_filter( $enabled ) ) );
221
 
222
  return apply_filters( 'cme_assisted_post_types', $post_types, $type_args );
206
  return $caps;
207
  }
208
 
209
+ // Note: this intentionally shares "presspermit_enabled_post_types" option with PublishPress Permissions
210
  function cme_get_assisted_post_types() {
211
  $type_args = array( 'public' => true, 'show_ui' => true );
212
 
216
  $post_types = array_diff_key( $types, array_fill_keys( (array) $omit_types, true ) );
217
  }
218
 
219
+ $option_name = (defined('PRESSPERMIT_VERSION')) ? 'presspermit_enabled_post_types' : 'pp_enabled_post_types';
220
+ $enabled = (array) get_option( $option_name, array( 'post' => true, 'page' => true ) );
221
  $post_types = array_intersect( $post_types, array_keys( array_filter( $enabled ) ) );
222
 
223
  return apply_filters( 'cme_assisted_post_types', $post_types, $type_args );
includes/pp-handler.php CHANGED
@@ -48,7 +48,7 @@ function _cme_update_pp_usage() {
48
 
49
  update_option( $option_name, $value );
50
 
51
- if ( 'pp_enabled_post_types' == $option_name ) {
52
  // ensure smooth transition if Press Permit Core is deactivated
53
  update_option( 'cme_enabled_post_types', $value );
54
  }
48
 
49
  update_option( $option_name, $value );
50
 
51
+ if (in_array($option_name, ['presspermit_enabled_post_types', 'pp_enabled_post_types'])) {
52
  // ensure smooth transition if Press Permit Core is deactivated
53
  update_option( 'cme_enabled_post_types', $value );
54
  }
readme.txt CHANGED
@@ -7,7 +7,7 @@ Tags: user roles, capabilities, permissions, authors, editors, post types, taxon
7
  Requires at least: 4.9.7
8
  Tested up to: 5.4
9
  Requires PHP: 5.6.20
10
- Stable tag: 1.9.4
11
  License: GPLv3
12
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
13
 
@@ -114,6 +114,10 @@ Fixed : Non-administrators with user editing capabilities could add new Administ
114
 
115
  == Changelog ==
116
 
 
 
 
 
117
  = 1.9.4 - 2 Apr 2020 =
118
  * Fixed : Fatal error loading Capabilities screen on a small percentage of installations
119
  * Fixed : Capabilities menu was displayed to non-Administrators with no items except "Upgrade to Pro"
7
  Requires at least: 4.9.7
8
  Tested up to: 5.4
9
  Requires PHP: 5.6.20
10
+ Stable tag: 1.9.5
11
  License: GPLv3
12
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
13
 
114
 
115
  == Changelog ==
116
 
117
+ = 1.9.5 - 6 Apr 2020 =
118
+ * Fixed : Fatal error loading Capabilities screen on a small percentage of installations
119
+ * Compat : PublishPress Permissions - Post Type selections for "Type-Specific Capabilities" were not synchronized with PublishPress Permissions under some conditions
120
+
121
  = 1.9.4 - 2 Apr 2020 =
122
  * Fixed : Fatal error loading Capabilities screen on a small percentage of installations
123
  * Fixed : Capabilities menu was displayed to non-Administrators with no items except "Upgrade to Pro"
vendor/publishpress/wordpress-version-notices/src/Template/TemplateLoader.php CHANGED
@@ -58,7 +58,8 @@ class TemplateLoader implements TemplateLoaderInterface
58
  $templatePath = $this->templatesPath . '/' . $moduleName . '/' . $templateName . '.php';
59
 
60
  if (!file_exists($templatePath)) {
61
- throw new TemplateNotFoundException('Template file not found');
 
62
  }
63
 
64
  if ($return) {
58
  $templatePath = $this->templatesPath . '/' . $moduleName . '/' . $templateName . '.php';
59
 
60
  if (!file_exists($templatePath)) {
61
+ //throw new TemplateNotFoundException('Template file not found');
62
+ return false;
63
  }
64
 
65
  if ($return) {