Capability Manager Enhanced - Version 1.9.4

Version Description

  • 2 Apr 2020 =
    • Fixed : Fatal error loading Capabilities screen on a small percentage of installations
    • Fixed : Capabilities menu was displayed to non-Administrators with no items except "Upgrade to Pro"
Download this release

Release Info

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

Code changes from version 1.9.3 to 1.9.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: 1.9.3
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.3
29
*/
30
31
if (!defined('CAPSMAN_VERSION')) {
32
- define('CAPSMAN_VERSION', '1.9.3');
33
- define('CAPSMAN_ENH_VERSION', '1.9.3');
34
- define('PUBLISHPRESS_CAPS_VERSION', '1.9.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: 1.9.4
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.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) {
includes/CoreAdmin.php CHANGED
@@ -6,13 +6,13 @@ class CoreAdmin {
6
add_action('admin_print_scripts', [$this, 'setUpgradeMenuLink'], 50);
7
8
if (is_admin()) {
9
- $autoloadPath = PUBLISHPRESS_CAPS_ABSPATH . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
10
if (file_exists($autoloadPath)) {
11
require_once $autoloadPath;
12
}
13
14
- require_once PUBLISHPRESS_CAPS_ABSPATH . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'publishpress' . DIRECTORY_SEPARATOR
15
- . 'wordpress-version-notices' . DIRECTORY_SEPARATOR . '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' . '/'
15
+ . 'wordpress-version-notices' . '/' . 'includes.php';
16
17
add_filter(\PPVersionNotices\Module\TopNotice\Module::SETTINGS_FILTER, function ($settings) {
18
$settings['capabilities'] = [
includes/admin.php CHANGED
@@ -604,14 +604,14 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
604
if (defined('PUBLISHPRESS_VERSION')) {
605
$plugin_caps['PublishPress'] = apply_filters('cme_publishpress_capabilities',
606
array(
607
- 'edit_metadata',
608
- 'edit_post_subscriptions',
609
- 'ppma_edit_orphan_post',
610
- 'pp_manage_roles',
611
- 'pp_set_notification_channel',
612
- 'pp_view_calendar',
613
- 'pp_view_content_overview',
614
- 'status_change',
615
)
616
);
617
}
604
if (defined('PUBLISHPRESS_VERSION')) {
605
$plugin_caps['PublishPress'] = apply_filters('cme_publishpress_capabilities',
606
array(
607
+ 'edit_metadata',
608
+ 'edit_post_subscriptions',
609
+ 'ppma_edit_orphan_post',
610
+ 'pp_manage_roles',
611
+ 'pp_set_notification_channel',
612
+ 'pp_view_calendar',
613
+ 'pp_view_content_overview',
614
+ 'status_change',
615
)
616
);
617
}
includes/backup.php CHANGED
@@ -39,7 +39,7 @@ $auto_backups = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb-
39
<h2><?php printf( __('Backup Tool for %1$sPublishPress Capabilities%2$s', 'capsman-enhanced'), '<a href="admin.php?page=capsman">', '</a>' );?></h2>
40
41
<form method="post" action="admin.php?page=<?php echo $this->ID ?>-tool">
42
- <?php wp_nonce_field('capsman-backup-tool');?>
43
<fieldset>
44
<table id="akmin">
45
<tr>
39
<h2><?php printf( __('Backup Tool for %1$sPublishPress Capabilities%2$s', 'capsman-enhanced'), '<a href="admin.php?page=capsman">', '</a>' );?></h2>
40
41
<form method="post" action="admin.php?page=<?php echo $this->ID ?>-tool">
42
+ <?php wp_nonce_field('capsman-backup-tool'); ?>
43
<fieldset>
44
<table id="akmin">
45
<tr>
includes/functions-admin.php CHANGED
@@ -10,9 +10,9 @@ function cme_submenus() {
10
11
$cap_name = (is_multisite() && is_super_admin()) ? 'read' : 'manage_capabilities';
12
13
- $permissions_title = __('Capabilities', 'capsman-enhanced');
14
15
- $menu_order = 72;
16
17
if (defined('PUBLISHPRESS_PERMISSIONS_MENU_GROUPING')) {
18
foreach (get_option('active_plugins') as $plugin_file) {
@@ -22,24 +22,24 @@ function cme_submenus() {
22
}
23
}
24
25
- add_menu_page(
26
- $permissions_title,
27
- $permissions_title,
28
- $cap_name,
29
- 'capsman',
30
- 'cme_fakefunc',
31
- 'dashicons-admin-network',
32
$menu_order
33
- );
34
35
- add_submenu_page('capsman', __('Backup', 'capsman-enhanced'), __('Backup', 'capsman-enhanced'), $cap_name, 'capsman' . '-tool', 'cme_fakefunc');
36
37
if (!defined('PUBLISHPRESS_CAPS_PRO_VERSION')) {
38
add_submenu_page(
39
'capsman',
40
__('Upgrade to Pro', 'capsman-enhanced'),
41
__('Upgrade to Pro', 'capsman-enhanced'),
42
- 'read',
43
'capabilities-pro',
44
'cme_fakefunc'
45
);
10
11
$cap_name = (is_multisite() && is_super_admin()) ? 'read' : 'manage_capabilities';
12
13
+ $permissions_title = __('Capabilities', 'capsman-enhanced');
14
15
+ $menu_order = 72;
16
17
if (defined('PUBLISHPRESS_PERMISSIONS_MENU_GROUPING')) {
18
foreach (get_option('active_plugins') as $plugin_file) {
22
}
23
}
24
25
+ add_menu_page(
26
+ $permissions_title,
27
+ $permissions_title,
28
+ $cap_name,
29
+ 'capsman',
30
+ 'cme_fakefunc',
31
+ 'dashicons-admin-network',
32
$menu_order
33
+ );
34
35
+ add_submenu_page('capsman', __('Backup', 'capsman-enhanced'), __('Backup', 'capsman-enhanced'), $cap_name, 'capsman' . '-tool', 'cme_fakefunc');
36
37
if (!defined('PUBLISHPRESS_CAPS_PRO_VERSION')) {
38
add_submenu_page(
39
'capsman',
40
__('Upgrade to Pro', 'capsman-enhanced'),
41
__('Upgrade to Pro', 'capsman-enhanced'),
42
+ 'manage_capabilities',
43
'capabilities-pro',
44
'cme_fakefunc'
45
);
includes/manager.php CHANGED
@@ -306,13 +306,13 @@ class CapabilityManager
306
'capsman',
307
__('Upgrade to Pro', 'capsman-enhanced'),
308
__('Upgrade to Pro', 'capsman-enhanced'),
309
- 'read',
310
'capabilities-pro',
311
array($this, 'generalManager')
312
);
313
}
314
}
315
-
316
/**
317
* Sets the 'manage_capabilities' cap to the administrator role.
318
*
@@ -472,7 +472,7 @@ class CapabilityManager
472
$capsman_modify->adminDeleteRole();
473
}
474
475
- if (!isset($this->current)) { // By default, we manage the default role
476
if (empty($_POST) && !empty($_REQUEST['role'])) {
477
$this->current = $_REQUEST['role'];
478
}
306
'capsman',
307
__('Upgrade to Pro', 'capsman-enhanced'),
308
__('Upgrade to Pro', 'capsman-enhanced'),
309
+ 'manage_capabilities',
310
'capabilities-pro',
311
array($this, 'generalManager')
312
);
313
}
314
}
315
+
316
/**
317
* Sets the 'manage_capabilities' cap to the administrator role.
318
*
472
$capsman_modify->adminDeleteRole();
473
}
474
475
+ if ( ! isset($this->current) ) { // By default, we manage the default role
476
if (empty($_POST) && !empty($_REQUEST['role'])) {
477
$this->current = $_REQUEST['role'];
478
}
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.3
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.3 - 17 Mar 2020 =
118
* Fixed : Capabilities screen was not accessible to non-Administrators who have "manage_capabilities" capability
119
* Fixed : Some functions were not accessible to network Super Administrators without a role on the site
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
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"
120
+
121
= 1.9.3 - 17 Mar 2020 =
122
* Fixed : Capabilities screen was not accessible to non-Administrators who have "manage_capabilities" capability
123
* Fixed : Some functions were not accessible to network Super Administrators without a role on the site
vendor/composer/installed.json CHANGED
@@ -109,12 +109,12 @@
109
"source": {
110
"type": "git",
111
"url": "https://github.com/publishpress/WordPress-Version-Notices.git",
112
- "reference": "8f359bd2d7f72f2ef27fca3758825b505e7e65dd"
113
},
114
"dist": {
115
"type": "zip",
116
- "url": "https://api.github.com/repos/publishpress/WordPress-Version-Notices/zipball/8f359bd2d7f72f2ef27fca3758825b505e7e65dd",
117
- "reference": "8f359bd2d7f72f2ef27fca3758825b505e7e65dd",
118
"shasum": ""
119
},
120
"require": {
@@ -124,7 +124,7 @@
124
"require-dev": {
125
"lucatume/wp-browser": "^2.2"
126
},
127
- "time": "2020-03-16T22:13:50+00:00",
128
"type": "library",
129
"installation-source": "dist",
130
"autoload": {
109
"source": {
110
"type": "git",
111
"url": "https://github.com/publishpress/WordPress-Version-Notices.git",
112
+ "reference": "a86b0c364d973cd27d2bf5e73ef5afc131430e86"
113
},
114
"dist": {
115
"type": "zip",
116
+ "url": "https://api.github.com/repos/publishpress/WordPress-Version-Notices/zipball/a86b0c364d973cd27d2bf5e73ef5afc131430e86",
117
+ "reference": "a86b0c364d973cd27d2bf5e73ef5afc131430e86",
118
"shasum": ""
119
},
120
"require": {
124
"require-dev": {
125
"lucatume/wp-browser": "^2.2"
126
},
127
+ "time": "2020-04-02T16:14:09+00:00",
128
"type": "library",
129
"installation-source": "dist",
130
"autoload": {
vendor/publishpress/wordpress-version-notices/README.md CHANGED
@@ -17,8 +17,7 @@ Due to a conflict in the tests we didn't register the include file in the Compos
17
18
```php
19
if (!defined('PP_VERSION_NOTICES_LOADED')) {
20
- require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'publishpress' . DIRECTORY_SEPARATOR
21
- . 'wordpress-version-notices' . DIRECTORY_SEPARATOR . 'includes.php';
22
}
23
24
add_filter(\PPVersionNotices\Module\TopNotice\Module::SETTINGS_FILTER, function ($settings) {
17
18
```php
19
if (!defined('PP_VERSION_NOTICES_LOADED')) {
20
+ require_once __DIR__ . '/vendor/publishpress/wordpress-version-notices/includes.php';
21
}
22
23
add_filter(\PPVersionNotices\Module\TopNotice\Module::SETTINGS_FILTER, function ($settings) {
vendor/publishpress/wordpress-version-notices/includes.php CHANGED
@@ -27,12 +27,12 @@ use Pimple\Container;
27
use PPVersionNotices\ServicesProvider;
28
29
if (!defined('PP_VERSION_NOTICES_LOADED')) {
30
- define('PP_VERSION_NOTICES_VERSION', '1.0.2');
31
define('PP_VERSION_NOTICES_BASE_PATH', __DIR__);
32
define('PP_VERSION_NOTICES_BASE_URL', untrailingslashit(plugin_dir_url(__FILE__)));
33
- define('PP_VERSION_NOTICES_SRC_PATH', PP_VERSION_NOTICES_BASE_PATH . DIRECTORY_SEPARATOR . 'src');
34
35
- if (file_exists(__DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php')) {
36
/*
37
* We need to check this because of the tests. Since we use composer the tests already loaded the class and
38
* the autoload.php file doesn't check that (it is generated by composer).
@@ -40,7 +40,7 @@ if (!defined('PP_VERSION_NOTICES_LOADED')) {
40
* Make sure to update the class name after running composer update or dump autoload.
41
*/
42
if (!class_exists('ComposerAutoloaderInit0ff73bab6c34dc502dbc3151d23f7930')) {
43
- require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
44
}
45
}
46
27
use PPVersionNotices\ServicesProvider;
28
29
if (!defined('PP_VERSION_NOTICES_LOADED')) {
30
+ define('PP_VERSION_NOTICES_VERSION', '1.0.3');
31
define('PP_VERSION_NOTICES_BASE_PATH', __DIR__);
32
define('PP_VERSION_NOTICES_BASE_URL', untrailingslashit(plugin_dir_url(__FILE__)));
33
+ define('PP_VERSION_NOTICES_SRC_PATH', PP_VERSION_NOTICES_BASE_PATH . '/src');
34
35
+ if (file_exists(__DIR__ . '/vendor/autoload.php')) {
36
/*
37
* We need to check this because of the tests. Since we use composer the tests already loaded the class and
38
* the autoload.php file doesn't check that (it is generated by composer).
40
* Make sure to update the class name after running composer update or dump autoload.
41
*/
42
if (!class_exists('ComposerAutoloaderInit0ff73bab6c34dc502dbc3151d23f7930')) {
43
+ require_once __DIR__ . '/vendor/autoload.php';
44
}
45
}
46
vendor/publishpress/wordpress-version-notices/src/ServicesProvider.php CHANGED
@@ -35,7 +35,7 @@ class ServicesProvider implements ServiceProviderInterface
35
public function register(Container $pimple)
36
{
37
$pimple['TEMPLATES_PATH'] = function (Container $c) {
38
- return PP_VERSION_NOTICES_BASE_PATH . DIRECTORY_SEPARATOR . 'templates';
39
};
40
41
$pimple['module_top_notice'] = function (Container $c) {
35
public function register(Container $pimple)
36
{
37
$pimple['TEMPLATES_PATH'] = function (Container $c) {
38
+ return PP_VERSION_NOTICES_BASE_PATH . '/templates';
39
};
40
41
$pimple['module_top_notice'] = function (Container $c) {
vendor/publishpress/wordpress-version-notices/src/Template/TemplateLoader.php CHANGED
@@ -55,7 +55,7 @@ class TemplateLoader implements TemplateLoaderInterface
55
*/
56
private function load($moduleName, $templateName, $context = [], $return = false)
57
{
58
- $templatePath = $this->templatesPath . DIRECTORY_SEPARATOR . $moduleName . DIRECTORY_SEPARATOR . $templateName . '.php';
59
60
if (!file_exists($templatePath)) {
61
throw new TemplateNotFoundException('Template file not found');
55
*/
56
private function load($moduleName, $templateName, $context = [], $return = false)
57
{
58
+ $templatePath = $this->templatesPath . '/' . $moduleName . '/' . $templateName . '.php';
59
60
if (!file_exists($templatePath)) {
61
throw new TemplateNotFoundException('Template file not found');
vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-one/version-notice.php CHANGED
@@ -25,8 +25,7 @@
25
26
// @todo: Load only in the admin
27
if (!defined('PP_VERSION_NOTICES_LOADED')) {
28
- require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'publishpress' . DIRECTORY_SEPARATOR
29
- . 'wordpress-version-notices' . DIRECTORY_SEPARATOR . 'includes.php';
30
}
31
32
add_filter(\PPVersionNotices\Module\TopNotice\Module::SETTINGS_FILTER, function ($settings) {
25
26
// @todo: Load only in the admin
27
if (!defined('PP_VERSION_NOTICES_LOADED')) {
28
+ require_once __DIR__ . '/vendor/publishpress/wordpress-version-notices/includes.php';
29
}
30
31
add_filter(\PPVersionNotices\Module\TopNotice\Module::SETTINGS_FILTER, function ($settings) {
vendor/publishpress/wordpress-version-notices/tests/_data/dumb-plugin-two/version-notice.php CHANGED
@@ -25,8 +25,7 @@
25
26
// @todo: Load only in the admin
27
if (!defined('PP_VERSION_NOTICES_LOADED')) {
28
- require_once __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'publishpress' . DIRECTORY_SEPARATOR
29
- . 'wordpress-version-notices' . DIRECTORY_SEPARATOR . 'includes.php';
30
}
31
32
add_filter(\PPVersionNotices\Module\TopNotice\Module::SETTINGS_FILTER, function ($settings) {
25
26
// @todo: Load only in the admin
27
if (!defined('PP_VERSION_NOTICES_LOADED')) {
28
+ require_once __DIR__ . '/vendor/publishpress/wordpress-version-notices/includes.php';
29
}
30
31
add_filter(\PPVersionNotices\Module\TopNotice\Module::SETTINGS_FILTER, function ($settings) {
vendor/publishpress/wordpress-version-notices/tests/wpunit/Template/TemplateLoaderTest.php CHANGED
@@ -23,8 +23,7 @@ class TemplateLoaderTest extends \Codeception\TestCase\WPTestCase
23
// Before...
24
parent::setUp();
25
26
- $templatePath = PP_VERSION_NOTICES_BASE_PATH . DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR . '_data' .
27
- DIRECTORY_SEPARATOR . 'dumb-templates';
28
29
$this->templateLoader = new TemplateLoader($templatePath);
30
}
23
// Before...
24
parent::setUp();
25
26
+ $templatePath = PP_VERSION_NOTICES_BASE_PATH . '/tests/_data/dumb-templates';
27
28
$this->templateLoader = new TemplateLoader($templatePath);
29
}