Capability Manager Enhanced - Version 1.9

Version Description

  • 9 Jan 2020 =
    • Change : Renamed to PublishPress Capabilities
    • Feature : Capabilities link on PublishPress > Roles row opens Role Capabilities screen
    • Feature : Role Capabilities screen links to PublishPress > Roles for member management
    • Fixed : Browser reload caused Role Capabilities screen to display default role
    • Fixed : Add Capability sidebar added custom capability to role immediately, but capability checkbox did not display as checked until reload
    • Fixed : Category Assign or Delete capabilities were not effective due to WordPress core forcing default capability requirement
    • Fixed : Term Assign or Delete capabilities were not effective due to WordPress core forcing default capability requirement
    • Fixed : Multisite - On sub-sites, Role Capabilities screen did not display PublishPress Capabilities section to Super Administrators who don't have a role on the site
    • Fixed : Role name captions on Role Capabilities and Backup Tool screens could not be translated
    • Fixed : Checkbox bulk selection on Role Capabilities screen was incorrect under some conditions
    • Change : Reinstate WordPress edit_published_posts workaround with correct status filtering behavior
    • Change : Apply workaround filters for WordPress edit_published_posts / publish_posts handling only for users who have edit_published_posts capability for current post type
Download this release

Release Info

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

Code changes from version 1.8.1 to 1.9

admin.css CHANGED
@@ -189,13 +189,17 @@ margin-top:5px;
189
}
190
191
td.cm-has-via-pp {
192
- background-color: #7f7;
193
}
194
195
div.pressshack-admin-wrapper footer {
196
padding-right: 270px;
197
}
198
199
#akmin div.publishpress-headline {line-height:25px}
200
#akmin span.publishpress-thanks{margin-left:5px;color:#655997;white-space:nowrap}
201
#akmin span.publishpress-thanks,#akmin span.publishpress-thanks a,#akmin span.publishpress-thanks a:visited {color:#655997;font-weight:bold;}
@@ -209,4 +213,11 @@ table#akmin td.sidebar li.publishpress-contact a{padding:5px 0 5px 0;}
209
#pp_features ul.pp-features { list-style: none; padding-top:10px; text-align:left; margin-left: auto }
210
#pp_features ul.pp-features li:before { content: "\2713\0020"; }
211
#pp_features ul.pp-features li { padding-bottom: 5px }
212
- #pp_features img.cme-play { margin-bottom: -3px; margin-left: 5px;}
189
}
190
191
td.cm-has-via-pp {
192
+ background-color: #84fb84;
193
}
194
195
div.pressshack-admin-wrapper footer {
196
padding-right: 270px;
197
}
198
199
+ body.capabilities_page_capsman-tool div.pressshack-admin-wrapper footer {
200
+ padding-right: 5px;
201
+ }
202
+
203
#akmin div.publishpress-headline {line-height:25px}
204
#akmin span.publishpress-thanks{margin-left:5px;color:#655997;white-space:nowrap}
205
#akmin span.publishpress-thanks,#akmin span.publishpress-thanks a,#akmin span.publishpress-thanks a:visited {color:#655997;font-weight:bold;}
213
#pp_features ul.pp-features { list-style: none; padding-top:10px; text-align:left; margin-left: auto }
214
#pp_features ul.pp-features li:before { content: "\2713\0020"; }
215
#pp_features ul.pp-features li { padding-bottom: 5px }
216
+ #pp_features img.cme-play { margin-bottom: -3px; margin-left: 5px;}
217
+
218
+ div.publishpress-caps-manage span.manage-members {margin-left:5px; font-weight:normal; color: #777}
219
+ div.publishpress-caps-manage span.manage-members a {color: #777}
220
+ div.publishpress-caps-manage span.manage-members a:hover {text-decoration: underline; color:#655997 }
221
+
222
+ div.publishpress-headline .cme-subtext a {font-weight: bold}
223
+ div.publishpress-headline .cme-subtext a:hover {text-decoration: underline}
admin.dev.js CHANGED
@@ -39,10 +39,10 @@ jQuery(document).ready( function($) {
39
});
40
41
$('table.cme-typecaps a.neg-type-caps').click( function(e) {
42
- $(this).closest('tr').find('td[class!="cap-neg"]').filter('td[class!="cap-unreg"]').each( function(e) {
43
$(this).addClass('cap-neg');
44
45
- var cap_name_attr = $(this).parent().find('input[type="checkbox"]').attr('name');
46
$(this).append('<input type="hidden" class="cme-negation-input" name="'+cap_name_attr+'" value="" />');
47
});
48
39
});
40
41
$('table.cme-typecaps a.neg-type-caps').click( function(e) {
42
+ $(this).closest('tr').find('td[class!="cap-neg"]').filter('td[class!="cap-unreg"]').each( function() {
43
$(this).addClass('cap-neg');
44
45
+ var cap_name_attr = $(this).find('input[type="checkbox"]').attr('name');
46
$(this).append('<input type="hidden" class="cme-negation-input" name="'+cap_name_attr+'" value="" />');
47
});
48
admin.js CHANGED
@@ -1,3 +1,3 @@
1
- jQuery(document).ready(function($){$('a.neg-cap').attr('title',cmeAdmin.negationCaption);$('a.neg-type-caps').attr('title',cmeAdmin.typeCapsNegationCaption);$('td.cap-unreg').attr('title',cmeAdmin.typeCapUnregistered);$('a.normal-cap').attr('title',cmeAdmin.switchableCaption);$('span.cap-x').attr('title',cmeAdmin.capNegated);$('table.cme-checklist input[class!="cme-check-all"]').not(':disabled').attr('title',cmeAdmin.chkCaption);$('table.cme-checklist a.neg-cap').click(function(e){$(this).closest('td').removeClass('cap-yes').removeClass('cap-no').addClass('cap-neg');var cap_name_attr=$(this).parent().find('input[type="checkbox"]').attr('name');$(this).after('<input type="hidden" class="cme-negation-input" name="'+cap_name_attr+'" value="" />');return false;});$(document).on('click','table.cme-typecaps span.cap-x,table.cme-checklist span.cap-x,table.cme-checklist td.cap-neg span',function(e){$(this).closest('td').removeClass('cap-neg').removeClass('cap-yes').addClass('cap-no');$(this).parent().find('input[type="checkbox"]').prop('checked',false);$(this).parent().find('input.cme-negation-input').remove();return false;});$('input.cme-check-all').click(function(e){$(this).closest('table').find('input[type="checkbox"][disabled!="disabled"]:visible').prop('checked',$(this).is(":checked"));});$('a.cme-neg-all').click(function(e){$(this).closest('table').find('a.neg-cap:visible').click();return false;});$('a.cme-switch-all').click(function(e){$(this).closest('table').find('td.cap-neg span').click();return false;});$('table.cme-typecaps a.neg-type-caps').click(function(e){$(this).closest('tr').find('td[class!="cap-neg"]').filter('td[class!="cap-unreg"]').each(function(e){$(this).addClass('cap-neg');var cap_name_attr=$(this).parent().find('input[type="checkbox"]').attr('name');$(this).append('<input type="hidden" class="cme-negation-input" name="'+cap_name_attr+'" value="" />');});return false;});$('table.cme-typecaps th').click(function(){var columnNo=$(this).index();var check_val=!$(this).prop('checked_all');if($(this).hasClass('term-cap'))
2
var class_sel='[class*="term-cap"]';else
3
var class_sel='[class*="post-cap"]';$(this).closest("table").find("tr td"+class_sel+":nth-child("+(columnNo+1)+') input[type="checkbox"]:visible').prop("checked",check_val);$(this).prop('checked_all',check_val);});$('a.cme-fix-read-cap').click(function(){$('input[name="caps[read]"]').prop('checked',true);$('input[name="SaveRole"]').trigger('click');return false;});});
1
+ jQuery(document).ready(function($){$('a.neg-cap').attr('title',cmeAdmin.negationCaption);$('a.neg-type-caps').attr('title',cmeAdmin.typeCapsNegationCaption);$('td.cap-unreg').attr('title',cmeAdmin.typeCapUnregistered);$('a.normal-cap').attr('title',cmeAdmin.switchableCaption);$('span.cap-x').attr('title',cmeAdmin.capNegated);$('table.cme-checklist input[class!="cme-check-all"]').not(':disabled').attr('title',cmeAdmin.chkCaption);$('table.cme-checklist a.neg-cap').click(function(e){$(this).closest('td').removeClass('cap-yes').removeClass('cap-no').addClass('cap-neg');var cap_name_attr=$(this).parent().find('input[type="checkbox"]').attr('name');$(this).after('<input type="hidden" class="cme-negation-input" name="'+cap_name_attr+'" value="" />');return false;});$(document).on('click','table.cme-typecaps span.cap-x,table.cme-checklist span.cap-x,table.cme-checklist td.cap-neg span',function(e){$(this).closest('td').removeClass('cap-neg').removeClass('cap-yes').addClass('cap-no');$(this).parent().find('input[type="checkbox"]').prop('checked',false);$(this).parent().find('input.cme-negation-input').remove();return false;});$('input.cme-check-all').click(function(e){$(this).closest('table').find('input[type="checkbox"][disabled!="disabled"]:visible').prop('checked',$(this).is(":checked"));});$('a.cme-neg-all').click(function(e){$(this).closest('table').find('a.neg-cap:visible').click();return false;});$('a.cme-switch-all').click(function(e){$(this).closest('table').find('td.cap-neg span').click();return false;});$('table.cme-typecaps a.neg-type-caps').click(function(e){$(this).closest('tr').find('td[class!="cap-neg"]').filter('td[class!="cap-unreg"]').each(function(){$(this).addClass('cap-neg');var cap_name_attr=$(this).find('input[type="checkbox"]').attr('name');$(this).append('<input type="hidden" class="cme-negation-input" name="'+cap_name_attr+'" value="" />');});return false;});$('table.cme-typecaps th').click(function(){var columnNo=$(this).index();var check_val=!$(this).prop('checked_all');if($(this).hasClass('term-cap'))
2
var class_sel='[class*="term-cap"]';else
3
var class_sel='[class*="post-cap"]';$(this).closest("table").find("tr td"+class_sel+":nth-child("+(columnNo+1)+') input[type="checkbox"]:visible').prop("checked",check_val);$(this).prop('checked_all',check_val);});$('a.cme-fix-read-cap').click(function(){$('input[name="caps[read]"]').prop('checked',true);$('input[name="SaveRole"]').trigger('click');return false;});});
capsman-enhanced.php CHANGED
@@ -1,16 +1,18 @@
1
<?php
2
/**
3
- * Plugin Name: Capability Manager Enhanced
4
- * Plugin URI: https://publishpress.com
5
* Description: Manage WordPress role definitions, per-site or network-wide. Organizes post capabilities by post type and operation.
6
- * Version: 1.8.1
7
* Author: PublishPress
8
- * Author URI: https://publishpress.com
9
* Text Domain: capsman-enhanced
10
* Domain Path: /lang/
11
* License: GPLv3
12
*
13
- * Copyright (c) 2019 PublishPress
14
*
15
* ------------------------------------------------------------------------------
16
* Based on Capability Manager
@@ -20,168 +22,118 @@
20
*
21
* @package capability-manager-enhanced
22
* @author PublishPress
23
- * @copyright Copyright (C) 2009, 2010 Jordi Canals; modifications Copyright (C) 2019 PublishPress
24
* @license GNU General Public License version 3
25
- * @link https://publishpress.com
26
- * @version 1.8
27
*/
28
29
- if ( ! defined( 'CAPSMAN_VERSION' ) ) {
30
- define( 'CAPSMAN_VERSION', '1.8.1' );
31
- define( 'CAPSMAN_ENH_VERSION', '1.8.1' );
32
}
33
34
- if ( cme_is_plugin_active( 'capsman.php' ) ) {
35
- function _cme_conflict_notice() {
36
- $message = __( '<strong>Error:</strong> Capability Manager Extended cannot function because another copy of Capability Manager is active.', 'capsman-enhanced' );
37
- echo '<div id="message" class="error fade" style="color: black">' . $message . '</div>';
38
- }
39
- add_action('admin_notices', _cme_conflict_notice() );
40
- return;
41
- } else {
42
- define ( 'CME_FILE', __FILE__ );
43
-
44
- /**
45
- * Sets an admin warning regarding required PHP version.
46
- *
47
- * @hook action 'admin_notices'
48
- * @return void
49
- */
50
- function _cman_php_warning() {
51
- $data = get_plugin_data(__FILE__);
52
- load_plugin_textdomain('capsman-enhanced', false, basename(dirname(__FILE__)) .'/lang');
53
-
54
- echo '<div class="error"><p><strong>' . __('Warning:', 'capsman-enhanced') . '</strong> '
55
- . sprintf(__('The active plugin %s is not compatible with your PHP version.', 'capsman-enhanced') .'</p><p>',
56
- '&laquo;' . $data['Name'] . ' ' . $data['Version'] . '&raquo;')
57
- . sprintf(__('%s is required for this plugin.', 'capsman-enhanced'), 'PHP-5 ')
58
- . '</p></div>';
59
- }
60
-
61
- // ============================================ START PROCEDURE ==========
62
-
63
- // Check required PHP version.
64
- if ( version_compare(PHP_VERSION, '5.0.0', '<') ) {
65
- // Send an armin warning
66
- add_action('admin_notices', '_cman_php_warning');
67
- } else {
68
- global $pagenow;
69
-
70
- if ( is_admin() &&
71
- ( isset($_REQUEST['page']) && in_array( $_REQUEST['page'], array( 'capsman', 'capsman-tool' ) )
72
- || ( ! empty($_SERVER['SCRIPT_NAME']) && strpos( $_SERVER['SCRIPT_NAME'], 'p-admin/plugins.php' ) && ! empty($_REQUEST['action'] ) )
73
- || ( isset($_GET['action']) && 'reset-defaults' == $_GET['action'] )
74
- || in_array( $pagenow, array( 'users.php', 'user-edit.php', 'profile.php', 'user-new.php' ) )
75
- ) ) {
76
- global $capsman;
77
-
78
- // Run the plugin
79
- require_once ( dirname(__FILE__) . '/framework/lib/formating.php' );
80
- require_once ( dirname(__FILE__) . '/framework/lib/users.php' );
81
-
82
- require_once ( dirname(__FILE__) . '/includes/manager.php' );
83
- $capsman = new CapabilityManager();
84
- } else {
85
- load_plugin_textdomain('capsman-enhanced', false, basename(dirname(__FILE__)) .'/lang');
86
- add_action( 'admin_menu', 'cme_submenus', 20 );
87
- }
88
}
89
}
90
91
- add_action( 'init', '_cme_init' );
92
- add_action( 'plugins_loaded', '_cme_act_pp_active', 1 );
93
-
94
- add_action( 'init', '_cme_cap_helper', 49 ); // Press Permit Cap Helper, registered at 50, will leave caps which we've already defined
95
- //add_action( 'wp_loaded', '_cme_cap_helper_late_init', 99 ); // now instead adding registered_post_type, registered_taxonomy action handlers for latecomers
96
- // @todo: do this in PP Core also
97
98
- function _cme_act_pp_active() {
99
- if ( defined('PRESSPERMIT_VERSION') || ( defined('PPC_VERSION') && function_exists( 'pp_init_cap_caster' ) ) ) {
100
- define( 'PRESSPERMIT_ACTIVE', true );
101
- } else {
102
- if ( defined('SCOPER_VERSION') || ( defined('PP_VERSION') && function_exists('pp_init_users_interceptor') ) ) {
103
- define( 'OLD_PRESSPERMIT_ACTIVE', true );
104
- }
105
- }
106
}
107
108
- function _cme_cap_helper() {
109
- global $cme_cap_helper;
110
-
111
- require_once ( dirname(__FILE__) . '/includes/cap-helper.php' );
112
- $cme_cap_helper = new CME_Cap_Helper();
113
-
114
- add_action( 'registered_post_type', '_cme_post_type_late_reg', 5, 2 );
115
- add_action( 'registered_taxonomy', '_cme_taxonomy_late_reg', 5, 2 );
116
}
117
118
- function _cme_post_type_late_reg( $post_type, $type_obj ) {
119
- global $cme_cap_helper;
120
-
121
- if ( ! empty( $type_obj->public ) || ! empty( $type_obj->show_ui ) ) {
122
- $cme_cap_helper->refresh();
123
- }
124
}
125
126
- function _cme_taxonomy_late_reg( $taxonomy, $tx_obj ) {
127
- global $cme_cap_helper;
128
-
129
- if ( ! empty( $tx_obj->public ) ) {
130
- $cme_cap_helper->refresh();
131
- }
132
}
133
134
- function _cme_init() {
135
- require_once ( dirname(__FILE__) . '/includes/filters.php' );
136
137
- load_plugin_textdomain('capsman-enhanced', false, dirname(__FILE__) . '/lang');
138
- }
139
140
- // perf enchancement: display submenu links without loading framework and plugin code
141
- function cme_submenus() {
142
- $cap_name = ( is_super_admin() ) ? 'manage_capabilities' : 'restore_roles';
143
- add_management_page(__('Capability Manager', 'capsman-enhanced'), __('Capability Manager', 'capsman-enhanced'), $cap_name, 'capsman' . '-tool', 'cme_fakefunc');
144
-
145
- if (did_action('pp_admin_menu')) { // Put Capabilities link on Permissions menu if Press Permit is active and user has access to it
146
- global $pp_admin;
147
- $menu_caption = ( defined('WPLANG') && WPLANG && ( 'en_EN' != WPLANG ) ) ? __('Capabilities', 'capsman-enhanced') : 'Role Capabilities';
148
- add_submenu_page( $pp_admin->get_menu('options'), __('Capability Manager', 'capsman-enhanced'), $menu_caption, 'manage_capabilities', 'capsman', 'cme_fakefunc' );
149
-
150
- } elseif(did_action('presspermit_admin_menu') && function_exists('presspermit')) {
151
- $menu_caption = ( defined('WPLANG') && WPLANG && ( 'en_EN' != WPLANG ) ) ? __('Capabilities', 'capsman-enhanced') : 'Role Capabilities';
152
- add_submenu_page( presspermit()->admin()->getMenuParams('options'), __('Capability Manager', 'capsman-enhanced'), $menu_caption, 'manage_capabilities', 'capsman', 'cme_fakefunc' );
153
-
154
- } else {
155
- add_users_page( __('Capability Manager', 'capsman-enhanced'), __('Capabilities', 'capsman-enhanced'), 'manage_capabilities', 'capsman', 'cme_fakefunc');
156
- }
157
}
158
159
- function cme_is_plugin_active($check_plugin_file) {
160
- if ( ! $check_plugin_file )
161
- return false;
162
163
- $plugins = get_option('active_plugins');
164
-
165
- foreach ( $plugins as $plugin_file ) {
166
- if ( false !== strpos($plugin_file, $check_plugin_file) )
167
- return $plugin_file;
168
- }
169
- }
170
171
- // if a role is marked as hidden, also default it for use by Press Permit as a Pattern Role (when PP Collaborative Editing is activated and Advanced Settings enabled)
172
- function _cme_pp_default_pattern_role( $role ) {
173
- if ( ! $pp_role_usage = get_option( 'pp_role_usage' ) )
174
- $pp_role_usage = array();
175
176
- if ( empty( $pp_role_usage[$role] ) ) {
177
- $pp_role_usage[$role] = 'pattern';
178
- update_option( 'pp_role_usage', $pp_role_usage );
179
}
180
}
181
182
- function capsman_get_pp_option( $option_basename ) {
183
- return ( function_exists( 'presspermit_get_option') ) ? presspermit_get_option($option_basename) : pp_get_option($option_basename);
184
- }
185
186
if ( is_multisite() )
187
- require_once ( dirname(__FILE__) . '/includes/network.php' );
1
<?php
2
/**
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
7
* Author: PublishPress
8
+ * Author URI: https://publishpress.com/
9
* Text Domain: capsman-enhanced
10
* Domain Path: /lang/
11
+ * Min WP Version: 4.9.7
12
+ * Requires PHP: 5.6.20
13
* License: GPLv3
14
*
15
+ * Copyright (c) 2020 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) 2020 PublishPress
26
* @license GNU General Public License version 3
27
+ * @link https://publishpress.com/
28
+ * @version 1.9
29
*/
30
31
+ if (!defined('CAPSMAN_VERSION')) {
32
+ define('CAPSMAN_VERSION', '1.9');
33
+ define('CAPSMAN_ENH_VERSION', '1.9');
34
+ define('PUBLISHPRESS_CAPS_VERSION', '1.9');
35
}
36
37
+ foreach (get_option('active_plugins') as $plugin_file) {
38
+ if ( false !== strpos($plugin_file, 'capsman.php') ) {
39
+ add_action('admin_notices', function() {
40
+ $message = __( '<strong>Error:</strong> PublishPress Capabilities cannot function because another copy of Capability Manager is active.', 'capsman-enhanced' );
41
+ echo '<div id="message" class="error fade" style="color: black">' . $message . '</div>';
42
+ });
43
+ return;
44
}
45
}
46
47
+ $pro_active = false;
48
49
+ foreach ((array)get_option('active_plugins') as $plugin_file) {
50
+ if (false !== strpos($plugin_file, 'capabilities-pro-by-publishpress.php')) {
51
+ $pro_active = true;
52
+ break;
53
+ }
54
}
55
56
+ if (!$pro_active && is_multisite()) {
57
+ foreach (array_keys((array)get_site_option('active_sitewide_plugins')) as $plugin_file) {
58
+ if (false !== strpos($plugin_file, 'capabilities-pro-by-publishpress.php')) {
59
+ $pro_active = true;
60
+ break;
61
+ }
62
+ }
63
}
64
65
+ if ($pro_active) {
66
+ add_filter(
67
+ 'plugin_row_meta',
68
+ function($links, $file)
69
+ {
70
+ if ($file == plugin_basename(__FILE__)) {
71
+ $links[]= __('<strong>This plugin can be deleted.</strong>', 'press-permit-core');
72
+ }
73
+
74
+ return $links;
75
+ },
76
+ 10, 2
77
+ );
78
}
79
80
+ if (defined('CME_FILE') || $pro_active) {
81
+ return;
82
}
83
84
+ define ( 'CME_FILE', __FILE__ );
85
+ define ('PUBLISHPRESS_CAPS_ABSPATH', __DIR__);
86
87
+ require_once (dirname(__FILE__) . '/includes/functions.php');
88
89
+ if (is_admin()) {
90
+ require_once (dirname(__FILE__) . '/includes/functions-admin.php');
91
}
92
93
+ // ============================================ START PROCEDURE ==========
94
95
+ // Check required PHP version.
96
+ if ( version_compare(PHP_VERSION, '5.4.0', '<') ) {
97
+ // Send an armin warning
98
+ add_action('admin_notices', function() {
99
+ $data = get_plugin_data(__FILE__);
100
+ load_plugin_textdomain('capsman-enhanced', false, basename(dirname(__FILE__)) .'/lang');
101
102
+ echo '<div class="error"><p><strong>' . __('Warning:', 'capsman-enhanced') . '</strong> '
103
+ . sprintf(__('The active plugin %s is not compatible with your PHP version.', 'capsman-enhanced') .'</p><p>',
104
+ '&laquo;' . $data['Name'] . ' ' . $data['Version'] . '&raquo;')
105
+ . sprintf(__('%s is required for this plugin.', 'capsman-enhanced'), 'PHP-5 ')
106
+ . '</p></div>';
107
+ });
108
+ } else {
109
+ global $pagenow;
110
+
111
+ if ( is_admin() &&
112
+ ( isset($_REQUEST['page']) && in_array( $_REQUEST['page'], array( 'capsman', 'capsman-tool' ) )
113
+ || ( ! empty($_SERVER['SCRIPT_NAME']) && strpos( $_SERVER['SCRIPT_NAME'], 'p-admin/plugins.php' ) && ! empty($_REQUEST['action'] ) )
114
+ || ( isset($_GET['action']) && 'reset-defaults' == $_GET['action'] )
115
+ || in_array( $pagenow, array( 'users.php', 'user-edit.php', 'profile.php', 'user-new.php' ) )
116
+ ) ) {
117
+ global $capsman;
118
+
119
+ // Run the plugin
120
+ require_once ( dirname(__FILE__) . '/framework/lib/formating.php' );
121
+ require_once ( dirname(__FILE__) . '/framework/lib/users.php' );
122
123
+ require_once ( dirname(__FILE__) . '/includes/manager.php' );
124
+ $capsman = new CapabilityManager();
125
+ } else {
126
+ load_plugin_textdomain('capsman-enhanced', false, basename(dirname(__FILE__)) .'/lang');
127
+ add_action( 'admin_menu', 'cme_submenus', 20 );
128
}
129
}
130
131
+ add_action( 'init', '_cme_init' );
132
+ add_action( 'plugins_loaded', '_cme_act_pp_active', 1 );
133
+
134
+ add_action( 'init', '_cme_cap_helper', 49 ); // Press Permit Cap Helper, registered at 50, will leave caps which we've already defined
135
+ //add_action( 'wp_loaded', '_cme_cap_helper_late_init', 99 ); // now instead adding registered_post_type, registered_taxonomy action handlers for latecomers
136
+ // @todo: do this in PP Core also
137
138
if ( is_multisite() )
139
+ require_once ( dirname(__FILE__) . '/includes/network.php' );
includes/admin.php CHANGED
@@ -1,16 +1,16 @@
1
<?php
2
/**
3
- * General Admin for Capability Manager.
4
* Provides admin pages to create and manage roles and capabilities.
5
*
6
* @author Jordi Canals, Kevin Behrens
7
- * @copyright Copyright (C) 2009, 2010 Jordi Canals, (C) 2019 PublishPress
8
* @license GNU General Public License version 2
9
* @link https://publishpress.com
10
*
11
*
12
* Copyright 2009, 2010 Jordi Canals <devel@jcanals.cat>
13
- * Modifications Copyright 2019, PublishPress <help@publishpress.com>
14
*
15
* This program is free software; you can redistribute it and/or
16
* modify it under the terms of the GNU General Public License
@@ -27,6 +27,8 @@
27
28
global $capsman, $cme_cap_helper, $current_user;
29
30
$roles = $this->roles;
31
$default = $this->current;
32
@@ -47,7 +49,7 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
47
$pp_metagroup_caps = array();
48
}
49
?>
50
- <div class="wrap pressshack-admin-wrapper">
51
<?php if( defined('PRESSPERMIT_ACTIVE') ) :
52
pp_icon();
53
$style = 'style="height:60px;"';
@@ -58,16 +60,25 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
58
<div id="icon-capsman-admin" class="icon32"></div>
59
<?php endif; ?>
60
61
- <h1 <?php echo $style;?>><?php _e('Roles and Capabilities', 'capsman-enhanced') ?></h1>
62
63
- <form method="post" action="admin.php?page=<?php echo $this->ID ?>">
64
<?php wp_nonce_field('capsman-general-manager'); ?>
65
<fieldset>
66
<table id="akmin">
67
<tr>
68
<td class="content">
69
<dl>
70
- <dt><?php printf(__('Capabilities for %s', 'capsman-enhanced'), $roles[$default]); ?></dt>
71
<dd>
72
<div style="float:right">
73
<input type="submit" name="SaveRole" value="<?php _e('Save Changes', 'capsman-enhanced') ?>" class="button-primary" /> &nbsp;
@@ -79,9 +90,21 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
79
?>
80
<div class="publishpress-headline">
81
<span class="cme-subtext">
82
- <?php _e( '<strong>Note:</strong> Capability changes <strong>remain in the database</strong> after plugin deactivation.', 'capsman-enhanced' ); ?>
83
</span>
84
- <span class="publishpress-thanks"> <?php printf( __( 'Thanks for using the %1$sPublishPress%2$s family of professional publishing tools.', 'capsman-enhanced'), '<a href="https://publishpress.com/" target="_blank">', '</a>' );?></span>
85
</div>
86
87
<?php
@@ -107,7 +130,7 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
107
108
<?php /* play.png icon by Pavel: http://kde-look.org/usermanager/search.php?username=InFeRnODeMoN */ ?>
109
110
- <br /><div id="pp_features" style="display:none"><div class="pp-logo"><a href="https://publishpress.com/presspermit/"><img src="<?php echo $img_url;?>pp-logo.png" alt="<?php _e('PressPermit Pro', 'capsman-enhanced');?>" /></a></div><div class="features-wrap"><ul class="pp-features">
111
<li>
112
<?php _e( "Automatically define type-specific capabilities for your custom post types and taxonomies", 'capsman-enhanced' );?>
113
<a href="https://presspermit.com/tutorial/regulate-post-type-access" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
@@ -118,7 +141,7 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
118
119
<li>
120
<?php _e( "Assign custom WP roles supplementally for a specific post type <em>(Pro)</em>", 'capsman-enhanced' );?>
121
- <a href="https://presspermit.com/tutorial/custom-role-usage" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
122
123
<li>
124
<?php _e( "Customize reading permissions per-category or per-post", 'capsman-enhanced' );?>
@@ -146,7 +169,7 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
146
147
<li>
148
<?php _e( "Grant Spectator, Participant or Moderator access to specific bbPress forums <em>(Pro)</em>", 'capsman-enhanced' );?>
149
- <a href="https://presspermit.com/tutorial/bbpress-exceptions" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
150
151
<li>
152
<?php _e( "Grant supplemental content permissions to a BuddyPress group <em>(Pro)</em>", 'capsman-enhanced' );?>
@@ -164,9 +187,9 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
164
165
<?php
166
echo '<div>';
167
- printf( __('%1$sgrab%2$s %3$s', 'capsman-enhanced'), '<strong>', '</strong>', '<span class="plugins update-message"><a href="' . cme_plugin_info_url('press-permit-core') . '" class="thickbox" title="' . sprintf( __('%s (free install)', 'capsman-enhanced'), 'PressPermit' ) . '">PressPermit</a></span>' );
168
echo '&nbsp;&nbsp;&bull;&nbsp;&nbsp;';
169
- printf( __('%1$sbuy%2$s %3$s', 'capsman-enhanced'), '<strong>', '</strong>', '<a href="https://publishpress.com/presspermit/" target="_blank" title="' . sprintf( __('%s info/purchase', 'capsman-enhanced'), 'PressPermit Pro' ) . '">PressPermit&nbsp;Pro</a>' );
170
echo '&nbsp;&nbsp;&bull;&nbsp;&nbsp;';
171
echo '<a href="#pp-hide">hide</a>';
172
echo '</div></div>';
@@ -182,13 +205,14 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
182
183
( method_exists( $wp_roles, 'for_site' ) ) ? $wp_roles->for_site() : $wp_roles->reinit();
184
}
185
$capsman->reinstate_db_roles();
186
187
$current = get_role($default);
188
189
$rcaps = $current->capabilities;
190
191
- $is_administrator = current_user_can( 'administrator' );
192
193
$custom_types = get_post_types( array( '_builtin' => false ), 'names' );
194
$custom_tax = get_taxonomies( array( '_builtin' => false ), 'names' );
@@ -280,7 +304,7 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
280
echo '<li>';
281
echo '<h3>' . $cap_type_names[$cap_type] . '</h3>';
282
283
- echo '<div class="cme-cap-type-tables">';
284
285
foreach( array_keys($defined) as $item_type ) {
286
if ( ( 'delete' == $cap_type ) && ( 'taxonomy' == $item_type ) ) {
@@ -303,7 +327,7 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
303
if ( ! count( $cap_properties[$cap_type][$item_type] ) )
304
continue;
305
306
- echo '<table class="cme-typecaps">';
307
308
echo '<tr><th></th>';
309
@@ -390,15 +414,15 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
390
391
if ( $is_administrator || current_user_can($cap_name) ) {
392
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
393
- $title_text = sprintf( __( '%s: assigned by Permission Group', 'capsman-enhanced' ), $cap_name );
394
} else {
395
- $title_text = $cap_name;
396
}
397
398
$disabled = '';
399
$checked = checked(1, ! empty($rcaps[$cap_name]), false );
400
401
- $checkbox = '<input type="checkbox" title="' . $title_text . '" name="caps[' . $cap_name . ']" value="1" ' . $checked . $disabled . ' />';
402
403
$type_caps [$cap_name] = true;
404
$display_row = true;
@@ -427,8 +451,9 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
427
428
if ('type' == $item_type) {
429
$type_metacaps[$type_obj->cap->read_post] = true;
430
- $type_metacaps[$type_obj->cap->edit_post] = true;
431
- $type_metacaps[$type_obj->cap->delete_post] = true;
432
} elseif ('taxonomy' == $item_type && !empty($type_obj->cap->edit_term) && !empty($type_obj->cap->delete_term)) {
433
$type_metacaps[$type_obj->cap->edit_term] = true;
434
$type_metacaps[$type_obj->cap->delete_term] = true;
@@ -450,6 +475,11 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
450
echo '</li>';
451
}
452
453
echo '</ul>';
454
455
// clicking on post type name toggles corresponding checkbox selections
@@ -561,16 +591,31 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
561
$all_capabilities = apply_filters( 'capsman_get_capabilities', array_keys( $this->capabilities ), $this->ID );
562
$all_capabilities = apply_filters( 'members_get_capabilities', $all_capabilities );
563
564
$publishpress_status_change_caps = array();
565
foreach( $all_capabilities as $cap_name ) {
566
if (0 === strpos($cap_name, 'status_change_')) {
567
$publishpress_status_change_caps []= $cap_name;
568
}
569
}
570
571
$plugin_caps = apply_filters('cme_plugin_capabilities',
572
- array(
573
- 'PressPermit' => apply_filters('cme_presspermit_capabilities',
574
array(
575
'edit_own_attachments',
576
'list_others_unattached_files',
@@ -606,20 +651,7 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
606
'set_posts_status',
607
)
608
),
609
- 'PublishPress' => apply_filters('cme_publishpress_capabilities',
610
- array_merge(
611
- array(
612
- 'edit_post_subscriptions',
613
- 'ppma_edit_orphan_post',
614
- 'pp_manage_roles',
615
- 'pp_set_notification_channel',
616
- 'pp_view_calendar',
617
- 'pp_view_content_overview',
618
- 'status_change',
619
- ),
620
- $publishpress_status_change_caps
621
- )
622
- ),
623
'WooCommerce' => apply_filters('cme_woocommerce_capabilities',
624
array(
625
'assign_product_terms',
@@ -708,11 +740,16 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
708
'view_woocommerce_reports',
709
)
710
),
711
- ));
712
713
foreach($plugin_caps as $plugin => $__plugin_caps) {
714
- if (!$_plugin_caps = array_fill_keys( array_intersect($__plugin_caps, $all_capabilities), true )) {
715
- continue;
716
}
717
718
echo '<h3 class="cme-cap-section">' . sprintf(__( '%s Capabilities', 'capsman-enhanced' ), str_replace('_', ' ', $plugin )) . '</h3>';
@@ -803,7 +840,9 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
803
804
uasort( $this->capabilities, 'strnatcasecmp' ); // sort by array values, but maintain keys );
805
806
- foreach ( $this->capabilities as $cap_name => $cap ) :
807
if ( isset( $type_caps[$cap_name] ) || isset($core_caps[$cap_name]) || isset($type_metacaps[$cap_name]) )
808
continue;
809
@@ -894,7 +933,7 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
894
</table>
895
896
<?php
897
- if (array_intersect(array_keys($type_metacaps), $all_capabilities)) {
898
899
$_title = esc_attr(__('Meta capabilities are used in code as placeholders for other capabilities. Assiging to a role has no effect.'));
900
echo '<p>&nbsp;</p><h3 class="cme-cap-section" title="' . $_title . '">' . __( 'Invalid Capabilities', 'capsman-enhanced' ) . '</h3>';
@@ -996,13 +1035,7 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
996
</select>
997
</span>
998
999
- <?php if ( ! defined('PRESSPERMIT_ACTIVE') || capsman_get_pp_option('display_hints') ) :?>
1000
- <span class="cme-subtext" style="float:right">
1001
- <?php _e( 'Note: Underscores replace spaces in stored capability name ("edit users" => "edit_users").', 'capsman-enhanced' ); ?>
1002
- </span>
1003
- <?php endif;?>
1004
</div>
1005
-
1006
</dd>
1007
</dl>
1008
@@ -1029,6 +1062,7 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
1029
<p><select name="role">
1030
<?php
1031
foreach ( $roles as $role => $name ) {
1032
echo '<option value="' . $role .'"'; selected($default, $role); echo '> ' . $name . ' &nbsp;</option>';
1033
}
1034
?>
@@ -1040,10 +1074,16 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
1040
/* <![CDATA[ */
1041
jQuery(document).ready( function($) {
1042
$('select[name="role"]').val('<?php echo $default;?>');
1043
});
1044
/* ]]> */
1045
</script>
1046
1047
<dl>
1048
<dt><?php _e('Create New Role', 'capsman-enhanced'); ?></dt>
1049
<dd style="text-align:center;">
@@ -1061,7 +1101,7 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
1061
</dl>
1062
1063
<dl>
1064
- <dt><?php defined('WPLANG') && WPLANG ? _e('Copy this role to', 'capsman-enhanced') : printf( 'Copy %s Role', $roles[$default] ); ?></dt>
1065
<dd style="text-align:center;">
1066
<?php $class = ( $support_pp_only_roles ) ? 'tight-text' : 'regular-text'; ?>
1067
<p><input type="text" name="copy-name" class="<?php echo $class;?>" placeholder="<?php _e('Role Name', 'capsman-enhanced') ?>" />
@@ -1084,12 +1124,12 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
1084
</dd>
1085
</dl>
1086
1087
- <dl class="cme-backup-tool">
1088
<dt><?php _e('Backup Tool', 'capsman-enhanced'); ?></dt>
1089
<dd style="text-align:center;">
1090
- <p><a href="tools.php?page=capsman-tool"><?php _e('Backup / Restore Roles', 'capsman-enhanced');?></a></p>
1091
</dd>
1092
- </dl>
1093
1094
<dl>
1095
<dt><?php _e('Related Permissions Plugins', 'capsman-enhanced'); ?></dt>
@@ -1098,7 +1138,7 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
1098
<li><a href="https://publishpress.com/ma/" target="_blank"><?php _e('Multiple Authors', 'capsman-enhanced');?></a></li>
1099
</li>
1100
1101
- <li><a href="#pp-more"><?php _e('PressPermit', 'capsman-enhanced');?></a>
1102
</li>
1103
1104
<?php $_url = "plugin-install.php?tab=plugin-information&plugin=publishpress&TB_iframe=true&width=640&height=678";
@@ -1120,6 +1160,8 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
1120
<?php
1121
$pp_ui->pp_types_ui( $defined['type'] );
1122
$pp_ui->pp_taxonomies_ui( $defined['taxonomy'] );
1123
?>
1124
</td>
1125
</tr>
@@ -1127,7 +1169,10 @@ if( defined('PRESSPERMIT_ACTIVE') ) {
1127
</fieldset>
1128
</form>
1129
1130
- <?php cme_publishpressFooter(); ?>
1131
</div>
1132
1133
<?php
@@ -1158,45 +1203,3 @@ function cme_plugin_info_url( $plugin_slug ) {
1158
$_url = "plugin-install.php?tab=plugin-information&plugin=$plugin_slug&TB_iframe=true&width=640&height=678";
1159
return ( is_multisite() ) ? network_admin_url($_url) : admin_url($_url);
1160
}
1161
-
1162
- function cme_publishpressFooter() {
1163
- ?>
1164
- <footer>
1165
-
1166
- <div class="pp-rating">
1167
- <a href="https://wordpress.org/support/plugin/capability-manager-enhanced/reviews/#new-post" target="_blank" rel="noopener noreferrer">
1168
- <?php printf(
1169
- __('If you like %s, please leave us a %s rating. Thank you!', 'capsman-enhanced'),
1170
- '<strong>Capability Manager Enhanced</strong>',
1171
- '<span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span>'
1172
- );
1173
- ?>
1174
- </a>
1175
- </div>
1176
-
1177
- <hr>
1178
- <nav>
1179
- <ul>
1180
- <li><a href="https://publishpress.com/capability-manager/" target="_blank" rel="noopener noreferrer" title="<?php _e('About Capability Manager Enhanced', 'capsman-enhanced');?>"><?php _e('About', 'capsman-enhanced');?>
1181
- </a></li>
1182
- <li><a href="https://publishpress.com/knowledge-base/how-to-use-capability-manager/" target="_blank" rel="noopener noreferrer" title="<?php _e('Capability Manager Enhanced Documentation', 'capsman-enhanced');?>"><?php _e('Documentation', 'capsman-enhanced');?>
1183
- </a></li>
1184
- <li><a href="https://publishpress.com/contact" target="_blank" rel="noopener noreferrer" title="<?php _e('Contact the PublishPress team', 'capsman-enhanced');?>"><?php _e('Contact', 'capsman-enhanced');?>
1185
- </a></li>
1186
- <li><a href="https://twitter.com/publishpresscom" target="_blank" rel="noopener noreferrer"><span class="dashicons dashicons-twitter"></span>
1187
- </a></li>
1188
- <li><a href="https://facebook.com/publishpress" target="_blank" rel="noopener noreferrer"><span class="dashicons dashicons-facebook"></span>
1189
- </a></li>
1190
- </ul>
1191
- </nav>
1192
-
1193
- <div class="pp-pressshack-logo">
1194
- <a href="https://publishpress.com" target="_blank" rel="noopener noreferrer">
1195
-
1196
- <img src="<?php echo plugins_url('', CME_FILE) . '/common/img/publishpress-logo.png';?>" />
1197
- </a>
1198
- </div>
1199
-
1200
- </footer>
1201
- <?php
1202
- }
1
<?php
2
/**
3
+ * General Admin for Role Capabilities.
4
* Provides admin pages to create and manage roles and capabilities.
5
*
6
* @author Jordi Canals, Kevin Behrens
7
+ * @copyright Copyright (C) 2009, 2010 Jordi Canals, (C) 2020 PublishPress
8
* @license GNU General Public License version 2
9
* @link https://publishpress.com
10
*
11
*
12
* Copyright 2009, 2010 Jordi Canals <devel@jcanals.cat>
13
+ * Modifications Copyright 2020, PublishPress <help@publishpress.com>
14
*
15
* This program is free software; you can redistribute it and/or
16
* modify it under the terms of the GNU General Public License
27
28
global $capsman, $cme_cap_helper, $current_user;
29
30
+ do_action('publishpress-caps_manager-load');
31
+
32
$roles = $this->roles;
33
$default = $this->current;
34
49
$pp_metagroup_caps = array();
50
}
51
?>
52
+ <div class="wrap publishpress-caps-manage pressshack-admin-wrapper">
53
<?php if( defined('PRESSPERMIT_ACTIVE') ) :
54
pp_icon();
55
$style = 'style="height:60px;"';
60
<div id="icon-capsman-admin" class="icon32"></div>
61
<?php endif; ?>
62
63
+ <h1 <?php echo $style;?>><?php _e('Role Capabilities', 'capsman-enhanced') ?></h1>
64
65
+ <form id="publishpress_caps_form" method="post" action="admin.php?page=<?php echo $this->ID ?>">
66
<?php wp_nonce_field('capsman-general-manager'); ?>
67
<fieldset>
68
<table id="akmin">
69
<tr>
70
<td class="content">
71
<dl>
72
+ <dt>
73
+ <?php
74
+ $role_caption = (defined('PUBLISHPRESS_VERSION'))
75
+ ? '<a href="' . admin_url("admin.php?page=pp-manage-roles&action=edit-role&role-id={$this->current}") . '">' . translate_user_role($roles[$default]) . '</a>'
76
+ : translate_user_role($roles[$default]);
77
+
78
+ printf(__('Capabilities for %s', 'capsman-enhanced'), $role_caption);
79
+ ?>
80
+ </dt>
81
+
82
<dd>
83
<div style="float:right">
84
<input type="submit" name="SaveRole" value="<?php _e('Save Changes', 'capsman-enhanced') ?>" class="button-primary" /> &nbsp;
90
?>
91
<div class="publishpress-headline">
92
<span class="cme-subtext">
93
+ <?php
94
+ $msg = __( '<strong>Note:</strong> Capability changes <strong>remain in the database</strong> after plugin deactivation.', 'capsman-enhanced' );
95
+
96
+ if (defined('PRESSPERMIT_ACTIVE') && function_exists('presspermit')) {
97
+ if ($group = presspermit()->groups()->getMetagroup('wp_role', $this->current)) {
98
+ $msg = sprintf(
99
+ __('<strong>Note:</strong> Capability changes <strong>remain in the database</strong> after plugin deactivation. You can also configure this role as a %sPermission Group%s.', 'capsman-enhanced'),
100
+ '<a href="' . admin_url("admin.php?page=presspermit-edit-permissions&action=edit&agent_id={$group->ID}") . '">',
101
+ '</a>'
102
+ );
103
+ }
104
+ }
105
+ echo $msg;
106
+ ?>
107
</span>
108
</div>
109
110
<?php
130
131
<?php /* play.png icon by Pavel: http://kde-look.org/usermanager/search.php?username=InFeRnODeMoN */ ?>
132
133
+ <br /><div id="pp_features" style="display:none"><div class="pp-logo"><a href="https://publishpress.com/presspermit/"><img src="<?php echo $img_url;?>pp-logo.png" alt="<?php _e('PublishPress Permissions', 'capsman-enhanced');?>" /></a></div><div class="features-wrap"><ul class="pp-features">
134
<li>
135
<?php _e( "Automatically define type-specific capabilities for your custom post types and taxonomies", 'capsman-enhanced' );?>
136
<a href="https://presspermit.com/tutorial/regulate-post-type-access" target="_blank"><img class="cme-play" alt="*" src="<?php echo $img_url;?>play.png" /></a></li>
141
142
<li>
143
<?php _e( "Assign custom WP roles supplementally for a specific post type <em>(Pro)</em>", 'capsman-enhanced' );?>
144
+ </li>
145
146
<li>
147
<?php _e( "Customize reading permissions per-category or per-post", 'capsman-enhanced' );?>
169
170
<li>
171
<?php _e( "Grant Spectator, Participant or Moderator access to specific bbPress forums <em>(Pro)</em>", 'capsman-enhanced' );?>
172
+ </li>
173
174
<li>
175
<?php _e( "Grant supplemental content permissions to a BuddyPress group <em>(Pro)</em>", 'capsman-enhanced' );?>
187
188
<?php
189
echo '<div>';
190
+ printf( __('%1$sgrab%2$s %3$s', 'capsman-enhanced'), '<strong>', '</strong>', '<span class="plugins update-message"><a href="' . cme_plugin_info_url('press-permit-core') . '" class="thickbox" title="' . sprintf( __('%s (free install)', 'capsman-enhanced'), 'Permissions Pro' ) . '">Permissions Pro</a></span>' );
191
echo '&nbsp;&nbsp;&bull;&nbsp;&nbsp;';
192
+ printf( __('%1$sbuy%2$s %3$s', 'capsman-enhanced'), '<strong>', '</strong>', '<a href="https://publishpress.com/presspermit/" target="_blank" title="' . sprintf( __('%s info/purchase', 'capsman-enhanced'), 'Permissions Pro' ) . '">Permissions&nbsp;Pro</a>' );
193
echo '&nbsp;&nbsp;&bull;&nbsp;&nbsp;';
194
echo '<a href="#pp-hide">hide</a>';
195
echo '</div></div>';
205
206
( method_exists( $wp_roles, 'for_site' ) ) ? $wp_roles->for_site() : $wp_roles->reinit();
207
}
208
+
209
$capsman->reinstate_db_roles();
210
211
$current = get_role($default);
212
213
$rcaps = $current->capabilities;
214
215
+ $is_administrator = current_user_can( 'administrator' ) || (is_multisite() && is_super_admin());
216
217
$custom_types = get_post_types( array( '_builtin' => false ), 'names' );
218
$custom_tax = get_taxonomies( array( '_builtin' => false ), 'names' );
304
echo '<li>';
305
echo '<h3>' . $cap_type_names[$cap_type] . '</h3>';
306
307
+ echo "<div class='cme-cap-type-tables cme-cap-type-tables-$cap_type'>";
308
309
foreach( array_keys($defined) as $item_type ) {
310
if ( ( 'delete' == $cap_type ) && ( 'taxonomy' == $item_type ) ) {
327
if ( ! count( $cap_properties[$cap_type][$item_type] ) )
328
continue;
329
330
+ echo "<table class='cme-typecaps cme-typecaps-$cap_type'>";
331
332
echo '<tr><th></th>';
333
414
415
if ( $is_administrator || current_user_can($cap_name) ) {
416
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
417
+ $title = ' title="' . sprintf( __( '%s: assigned by Permission Group', 'capsman-enhanced' ), $cap_name ) . '"';
418
} else {
419
+ $title = ' title="' . $cap_name . '"';
420
}
421
422
$disabled = '';
423
$checked = checked(1, ! empty($rcaps[$cap_name]), false );
424
425
+ $checkbox = '<input type="checkbox"' . $title . ' name="caps[' . $cap_name . ']" value="1" ' . $checked . $disabled . ' />';
426
427
$type_caps [$cap_name] = true;
428
$display_row = true;
451
452
if ('type' == $item_type) {
453
$type_metacaps[$type_obj->cap->read_post] = true;
454
+ $type_metacaps[$type_obj->cap->edit_post] = isset($type_obj->cap->edit_posts) && ($type_obj->cap->edit_post != $type_obj->cap->edit_posts);
455
+ $type_metacaps[$type_obj->cap->delete_post] = isset($type_obj->cap->delete_posts) && ($type_obj->cap->delete_post != $type_obj->cap->delete_posts);
456
+
457
} elseif ('taxonomy' == $item_type && !empty($type_obj->cap->edit_term) && !empty($type_obj->cap->delete_term)) {
458
$type_metacaps[$type_obj->cap->edit_term] = true;
459
$type_metacaps[$type_obj->cap->delete_term] = true;
475
echo '</li>';
476
}
477
478
+
479
+ do_action('publishpress-caps_manager_postcaps_section', compact('current', 'rcaps', 'pp_metagroup_caps', 'is_administrator', 'default_caps', 'custom_types', 'defined', 'unfiltered', 'pp_metagroup_caps'));
480
+
481
+ $type_caps = apply_filters('publishpress_caps_manager_typecaps', $type_caps);
482
+
483
echo '</ul>';
484
485
// clicking on post type name toggles corresponding checkbox selections
591
$all_capabilities = apply_filters( 'capsman_get_capabilities', array_keys( $this->capabilities ), $this->ID );
592
$all_capabilities = apply_filters( 'members_get_capabilities', $all_capabilities );
593
594
+ /*
595
$publishpress_status_change_caps = array();
596
foreach( $all_capabilities as $cap_name ) {
597
if (0 === strpos($cap_name, 'status_change_')) {
598
$publishpress_status_change_caps []= $cap_name;
599
}
600
}
601
+ */
602
603
$plugin_caps = apply_filters('cme_plugin_capabilities',
604
+ [
605
+ '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
+
618
+ 'PublishPress Permissions' => apply_filters('cme_presspermit_capabilities',
619
array(
620
'edit_own_attachments',
621
'list_others_unattached_files',
651
'set_posts_status',
652
)
653
),
654
+
655
'WooCommerce' => apply_filters('cme_woocommerce_capabilities',
656
array(
657
'assign_product_terms',
740
'view_woocommerce_reports',
741
)
742
),
743
+ ]
744
+ );
745
746
foreach($plugin_caps as $plugin => $__plugin_caps) {
747
+ if (!is_multisite() || !is_super_admin()) {
748
+ if (!$_plugin_caps = array_fill_keys( array_intersect($__plugin_caps, $all_capabilities), true )) {
749
+ continue;
750
+ }
751
+ } else {
752
+ $_plugin_caps = array_fill_keys($__plugin_caps, true);
753
}
754
755
echo '<h3 class="cme-cap-section">' . sprintf(__( '%s Capabilities', 'capsman-enhanced' ), str_replace('_', ' ', $plugin )) . '</h3>';
840
841
uasort( $this->capabilities, 'strnatcasecmp' ); // sort by array values, but maintain keys );
842
843
+ $additional_caps = apply_filters('publishpress_caps_manage_additional_caps', $this->capabilities);
844
+
845
+ foreach ($additional_caps as $cap_name => $cap) :
846
if ( isset( $type_caps[$cap_name] ) || isset($core_caps[$cap_name]) || isset($type_metacaps[$cap_name]) )
847
continue;
848
933
</table>
934
935
<?php
936
+ if (array_intersect(array_keys(array_filter($type_metacaps)), $all_capabilities)) {
937
938
$_title = esc_attr(__('Meta capabilities are used in code as placeholders for other capabilities. Assiging to a role has no effect.'));
939
echo '<p>&nbsp;</p><h3 class="cme-cap-section" title="' . $_title . '">' . __( 'Invalid Capabilities', 'capsman-enhanced' ) . '</h3>';
1035
</select>
1036
</span>
1037
1038
</div>
1039
</dd>
1040
</dl>
1041
1062
<p><select name="role">
1063
<?php
1064
foreach ( $roles as $role => $name ) {
1065
+ $name = translate_user_role($name);
1066
echo '<option value="' . $role .'"'; selected($default, $role); echo '> ' . $name . ' &nbsp;</option>';
1067
}
1068
?>
1074
/* <![CDATA[ */
1075
jQuery(document).ready( function($) {
1076
$('select[name="role"]').val('<?php echo $default;?>');
1077
+
1078
+ $('input.button[name="LoadRole"]').click(function(){
1079
+ $('#publishpress_caps_form').attr('action', 'admin.php?page=capsman&role=' + $('select[name="role"]').val());
1080
+ });
1081
});
1082
/* ]]> */
1083
</script>
1084
1085
+ <?php do_action('publishpress-caps_sidebar_top');?>
1086
+
1087
<dl>
1088
<dt><?php _e('Create New Role', 'capsman-enhanced'); ?></dt>
1089
<dd style="text-align:center;">
1101
</dl>
1102
1103
<dl>
1104
+ <dt><?php defined('WPLANG') && WPLANG ? _e('Copy this role to', 'capsman-enhanced') : printf('Copy %s Role', translate_user_role($roles[$default])); ?></dt>
1105
<dd style="text-align:center;">
1106
<?php $class = ( $support_pp_only_roles ) ? 'tight-text' : 'regular-text'; ?>
1107
<p><input type="text" name="copy-name" class="<?php echo $class;?>" placeholder="<?php _e('Role Name', 'capsman-enhanced') ?>" />
1124
</dd>
1125
</dl>
1126
1127
+ <!-- <dl class="cme-backup-tool">
1128
<dt><?php _e('Backup Tool', 'capsman-enhanced'); ?></dt>
1129
<dd style="text-align:center;">
1130
+ <p><a href="admin.php?page=capsman-tool"><?php _e('Backup / Restore Roles', 'capsman-enhanced');?></a></p>
1131
</dd>
1132
+ </dl> -->
1133
1134
<dl>
1135
<dt><?php _e('Related Permissions Plugins', 'capsman-enhanced'); ?></dt>
1138
<li><a href="https://publishpress.com/ma/" target="_blank"><?php _e('Multiple Authors', 'capsman-enhanced');?></a></li>
1139
</li>
1140
1141
+ <li><a href="#pp-more"><?php _e('PublishPress Permissions', 'capsman-enhanced');?></a>
1142
</li>
1143
1144
<?php $_url = "plugin-install.php?tab=plugin-information&plugin=publishpress&TB_iframe=true&width=640&height=678";
1160
<?php
1161
$pp_ui->pp_types_ui( $defined['type'] );
1162
$pp_ui->pp_taxonomies_ui( $defined['taxonomy'] );
1163
+
1164
+ do_action('publishpress-caps_sidebar_bottom');
1165
?>
1166
</td>
1167
</tr>
1169
</fieldset>
1170
</form>
1171
1172
+ <?php if (!defined('PUBLISHPRESS_CAPS_PRO_VERSION') || get_option('cme_display_branding')) {
1173
+ cme_publishpressFooter();
1174
+ }
1175
+ ?>
1176
</div>
1177
1178
<?php
1203
$_url = "plugin-install.php?tab=plugin-information&plugin=$plugin_slug&TB_iframe=true&width=640&height=678";
1204
return ( is_multisite() ) ? network_admin_url($_url) : admin_url($_url);
1205
}
includes/backup.php CHANGED
@@ -11,28 +11,31 @@
11
* @package Alkivia
12
* @subpackage CapsMan
13
*
14
-
15
- Copyright 2009, 2010 Jordi Canals <devel@jcanals.cat>
16
-
17
- This program is free software; you can redistribute it and/or
18
- modify it under the terms of the GNU General Public License
19
- version 2 as published by the Free Software Foundation.
20
-
21
- This program is distributed in the hope that it will be useful,
22
- but WITHOUT ANY WARRANTY; without even the implied warranty of
23
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24
- GNU General Public License for more details.
25
-
26
- You should have received a copy of the GNU General Public License
27
- along with this program. If not, see <http://www.gnu.org/licenses/>.
28
*/
29
30
?>
31
- <div class="wrap">
32
<div id="icon-capsman-admin" class="icon32"></div>
33
- <h2><?php printf( __('Backup Tool for %1$sCapability Manager%2$s', 'capsman-enhanced'), '<a href="admin.php?page=capsman">', '</a>' );?></h2>
34
35
- <form method="post" action="tools.php?page=<?php echo $this->ID ?>-tool">
36
<?php wp_nonce_field('capsman-backup-tool'); ?>
37
<fieldset>
38
<table id="akmin">
@@ -113,7 +116,7 @@
113
<?php
114
$role_caption = $props['name'];
115
if ( empty( $wp_roles->role_objects[$role] ) ) $role_caption = "<span class='cme-plus' style='color:green;font-weight:800'>$role_caption</span>";?>
116
- <h4><?php printf( __( '%s (level %s)', 'capsman-enhanced' ), $role_caption, $level );?></h4>
117
<ul style="list-style:disc;padding-left:30px">
118
119
<?php
@@ -141,7 +144,7 @@
141
<?php
142
_e('If you have installed any plugin that adds new roles or capabilities, these will be lost.', 'capsman-enhanced')?><br />
143
<strong><?php if ( defined('WPLANG') && WPLANG && ( 'en_EN' != WPLANG ) ) _e('It is recommended to use this only as a last resource!'); else echo('It is recommended to use this only as a last resort!');?></strong></p>
144
- <p style="text-align:center;"><a class="ak-delete" title="<?php echo esc_attr(__('Reset Roles and Capabilities to WordPress defaults', 'capsman-enhanced')) ?>" href="<?php echo wp_nonce_url("tools.php?page={$this->ID}-tool&amp;action=reset-defaults", 'capsman-reset-defaults'); ?>" onclick="if ( confirm('<?php echo esc_js(__("You are about to reset Roles and Capabilities to WordPress defaults.\n 'Cancel' to stop, 'OK' to reset.", 'capsman-enhanced')); ?>') ) { return true;}return false;"><?php _e('Reset to WordPress defaults', 'capsman-enhanced')?></a>
145
146
</dd>
147
</dl>
@@ -151,4 +154,9 @@
151
</table>
152
</fieldset>
153
</form>
154
- </div>
11
* @package Alkivia
12
* @subpackage CapsMan
13
*
14
+ *
15
+ * Copyright 2009, 2010 Jordi Canals <devel@jcanals.cat>
16
+ *
17
+ * Modifications Copyright 2020, PublishPress <help@publishpress.com>
18
+ *
19
+ * This program is free software; you can redistribute it and/or
20
+ * modify it under the terms of the GNU General Public License
21
+ * version 2 as published by the Free Software Foundation.
22
+ *
23
+ * This program is distributed in the hope that it will be useful,
24
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26
+ * GNU General Public License for more details.
27
+ *
28
+ * You should have received a copy of the GNU General Public License
29
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
30
*/
31
32
?>
33
+
34
+ <div class="wrap publishpress-caps-manage pressshack-admin-wrapper">
35
<div id="icon-capsman-admin" class="icon32"></div>
36
+ <h2><?php printf( __('Backup Tool for %1$sPublishPress Capabilities%2$s', 'capsman-enhanced'), '<a href="admin.php?page=capsman">', '</a>' );?></h2>
37
38
+ <form method="post" action="admin.php?page=<?php echo $this->ID ?>-tool">
39
<?php wp_nonce_field('capsman-backup-tool'); ?>
40
<fieldset>
41
<table id="akmin">
116
<?php
117
$role_caption = $props['name'];
118
if ( empty( $wp_roles->role_objects[$role] ) ) $role_caption = "<span class='cme-plus' style='color:green;font-weight:800'>$role_caption</span>";?>
119
+ <h4><?php printf( __( '%s (level %s)', 'capsman-enhanced' ), translate_user_role($role_caption), $level );?></h4>
120
<ul style="list-style:disc;padding-left:30px">
121
122
<?php
144
<?php
145
_e('If you have installed any plugin that adds new roles or capabilities, these will be lost.', 'capsman-enhanced')?><br />
146
<strong><?php if ( defined('WPLANG') && WPLANG && ( 'en_EN' != WPLANG ) ) _e('It is recommended to use this only as a last resource!'); else echo('It is recommended to use this only as a last resort!');?></strong></p>
147
+ <p style="text-align:center;"><a class="ak-delete" title="<?php echo esc_attr(__('Reset Roles and Capabilities to WordPress defaults', 'capsman-enhanced')) ?>" href="<?php echo wp_nonce_url("admin.php?page={$this->ID}-tool&amp;action=reset-defaults", 'capsman-reset-defaults'); ?>" onclick="if ( confirm('<?php echo esc_js(__("You are about to reset Roles and Capabilities to WordPress defaults.\n 'Cancel' to stop, 'OK' to reset.", 'capsman-enhanced')); ?>') ) { return true;}return false;"><?php _e('Reset to WordPress defaults', 'capsman-enhanced')?></a>
148
149
</dd>
150
</dl>
154
</table>
155
</fieldset>
156
</form>
157
+
158
+ <?php if (!defined('PUBLISHPRESS_CAPS_PRO_VERSION') || get_option('cme_display_branding')) {
159
+ cme_publishpressFooter();
160
+ }
161
+ ?>
162
+ </div>
includes/filters-wp_rest_workarounds.php CHANGED
@@ -5,22 +5,29 @@ namespace PublishPress\Capabilities;
5
* PublishPress\Capabilities\WP_REST_Workarounds class
6
*
7
* @author Kevin Behrens
8
- * @copyright Copyright (c) 2019, PublishPress
9
- * @link https://publishpress.com
10
*
11
*/
12
class WP_REST_Workarounds
13
{
14
- var $post_id = 0;
15
- var $is_posts_request = false;
16
17
- function __construct() {
18
add_filter('rest_pre_dispatch', [$this, 'fltRestPreDispatch'], 10, 3);
19
add_filter('user_has_cap', [$this, 'fltPublishCapReplacement'], 5, 3);
20
21
- add_filter('pre_post_status', [$this, 'fltPostStatus'], 10, 1);
22
- }
23
24
/**
25
* Work around Gutenberg editor enforcing publish_posts capability instead of edit_published_posts.
26
*
@@ -28,7 +35,9 @@ class WP_REST_Workarounds
28
* - The query pertains to a specific post
29
* - The post type and its capabilities are defined and match the current publish capability requirement
30
* - The post is already published with a public status, or scheduled
31
- *
32
* @author Kevin Behrens
33
* @link https://core.trac.wordpress.org/ticket/47443
34
* @link https://github.com/WordPress/gutenberg/issues/13342
@@ -38,8 +47,14 @@ class WP_REST_Workarounds
38
*/
39
public function fltPublishCapReplacement($wp_sitecaps, $reqd_caps, $args)
40
{
41
if ($reqd_cap = reset($reqd_caps)) {
42
- // slight compromise for perf: apply this workaround only when publish_posts capability for post type follows typical pattern (publish_*)
43
if (0 === strpos($reqd_cap, 'publish_')) {
44
if (!empty($wp_sitecaps[$reqd_cap])) {
45
return $wp_sitecaps;
@@ -68,48 +83,129 @@ class WP_REST_Workarounds
68
}
69
70
/**
71
- * If the post is already published, prevent the workaround from allowing status to be changed via "Switch to Draft" (or by any other means).
72
*
73
- * This will also prevent users with edit_published capability but not publish capability from unpublishing via Quick Edit.
74
- *
75
- * @param string $post_status New post status about to be saved
76
*/
77
- function fltPostStatus($post_status) {
78
global $current_user;
79
-
80
- if ($_post = get_post($this->getPostID())) {
81
- $type_obj = get_post_type_object($_post->post_type);
82
- $status_obj = get_post_status_object($_post->post_status);
83
84
- if ($type_obj && $status_obj && (!empty($status_obj->public) || !empty($status_obj->private) || 'future' == $_post->post_status)) {
85
- if (empty($current_user->allcaps[$type_obj->cap->publish_posts])) {
86
$post_status = $_post->post_status;
87
}
88
}
89
}
90
91
return $post_status;
92
}
93
94
- private function getPostID()
95
- {
96
- global $post;
97
-
98
- if (defined('REST_REQUEST') && REST_REQUEST && $this->is_posts_request) {
99
- return $this->post_id;
100
- }
101
102
- if (!empty($post) && is_object($post)) {
103
- return ('auto-draft' == $post->post_status) ? 0 : $post->ID;
104
- } elseif (isset($_REQUEST['post'])) {
105
- return (int)$_REQUEST['post'];
106
- } elseif (isset($_REQUEST['post_ID'])) {
107
- return (int)$_REQUEST['post_ID'];
108
- } elseif (isset($_REQUEST['post_id'])) {
109
- return (int)$_REQUEST['post_id'];
110
- }
111
}
112
113
public function fltRestPreDispatch($rest_response, $rest_server, $request)
114
{
115
$method = $request->get_method();
@@ -136,6 +232,9 @@ class WP_REST_Workarounds
136
}
137
138
$this->is_posts_request = true;
139
break 2;
140
}
141
}
@@ -143,4 +242,26 @@ class WP_REST_Workarounds
143
144
return $rest_response;
145
}
146
}
5
* PublishPress\Capabilities\WP_REST_Workarounds class
6
*
7
* @author Kevin Behrens
8
+ * @copyright Copyright (c) 2020, PublishPress
9
+ * @link https://publishpress.com/
10
*
11
*/
12
class WP_REST_Workarounds
13
{
14
+ private $post_id = 0;
15
+ private $is_posts_request = false;
16
+ private $is_view_method = false;
17
+ private $params = [];
18
+ private $skip_filtering = false;
19
20
+ public function __construct() {
21
add_filter('rest_pre_dispatch', [$this, 'fltRestPreDispatch'], 10, 3);
22
add_filter('user_has_cap', [$this, 'fltPublishCapReplacement'], 5, 3);
23
24
+ add_filter('wp_insert_post_data', [$this, 'fltInsertPostData'], 10, 2);
25
+ add_filter('edit_post_status', [$this, 'fltPostStatus'], 10, 2);
26
+ add_filter('user_has_cap', [$this, 'fltRegulateUnpublish'], 5, 3);
27
28
+ add_action('admin_print_styles-post.php', [$this, 'actAdminPrintScripts']);
29
+ }
30
+
31
/**
32
* Work around Gutenberg editor enforcing publish_posts capability instead of edit_published_posts.
33
*
35
* - The query pertains to a specific post
36
* - The post type and its capabilities are defined and match the current publish capability requirement
37
* - The post is already published with a public status, or scheduled
38
+ *
39
+ * Filter hook: 'user_has_cap'
40
+ *
41
* @author Kevin Behrens
42
* @link https://core.trac.wordpress.org/ticket/47443
43
* @link https://github.com/WordPress/gutenberg/issues/13342
47
*/
48
public function fltPublishCapReplacement($wp_sitecaps, $reqd_caps, $args)
49
{
50
+ if ($this->skip_filtering) {
51
+ return $wp_sitecaps;
52
+ }
53
+
54
+ $reqd_caps = (array) $reqd_caps;
55
+
56
if ($reqd_cap = reset($reqd_caps)) {
57
+ // slight compromise for perf: apply this workaround only when cap->publish_posts property for post type follows typical pattern (publish_*)
58
if (0 === strpos($reqd_cap, 'publish_')) {
59
if (!empty($wp_sitecaps[$reqd_cap])) {
60
return $wp_sitecaps;
83
}
84
85
/**
86
+ * Work around WordPress allowing user who can "edit_published_posts" but not "publish_posts" to unpublish a post.
87
+ *
88
+ * This is hooked to the edit_post_status filter and also called internally from REST update_item capability check (for Gutenberg)
89
+ * and wp_insert_post_data (for Classic Editor and Quick Edit)
90
+ *
91
+ * Filter hook: 'edit_post_status'
92
*
93
+ * @author Kevin Behrens
94
+ * @param int $post_status Post status being set
95
+ * @param int $post_id ID of post being modified
96
*/
97
+ public function fltPostStatus($post_status, $post_id) {
98
global $current_user;
99
100
+ $new_status_obj = get_post_status_object($post_status);
101
+ if (!$new_status_obj || !empty($new_status_obj->internal)) {
102
+ return $post_status;
103
+ }
104
+
105
+ if (!$_post = get_post($post_id)) {
106
+ return $post_status;
107
+ }
108
+
109
+ $type_obj = get_post_type_object($_post->post_type);
110
+ $status_obj = get_post_status_object($_post->post_status);
111
+
112
+ if ($type_obj && $status_obj && (!empty($status_obj->public) || !empty($status_obj->private) || 'future' == $_post->post_status)) {
113
+ // Apply this workaround only if current user has $type_obj->cap->edit_published_posts
114
+ if (isset($type_obj->cap->edit_published_posts) && !empty($current_user->allcaps[$type_obj->cap->edit_published_posts])) {
115
+ $this->skip_filtering = true;
116
+
117
+ if (!current_user_can($type_obj->cap->publish_posts)) {
118
$post_status = $_post->post_status;
119
}
120
+
121
+ $this->skip_filtering = false;
122
}
123
}
124
125
return $post_status;
126
}
127
128
+ /**
129
+ * Regulate post unpublishing on Classic Editor and Quick Edit updates:
130
+ * If a user can't publish a post, don't let them unpublish it either.
131
+ *
132
+ * Filter hook: 'wp_insert_post_data'
133
+ *
134
+ * @param array $data Parsed array of Post data being set
135
+ * @param array $postarr ARray of current post data
136
+ */
137
+ public function fltInsertPostData($data, $postarr) {
138
+ if (!empty($data['post_status']) && !empty($postarr['post_ID'])) {
139
+ $data['post_status'] = $this->fltPostStatus($data['post_status'], $postarr['post_ID']);
140
+ }
141
142
+ return $data;
143
}
144
+
145
+ /**
146
+ * Regulate post unpublishing on Gutenberg "Switch to Draft"
147
+ * If a user can't publish a post, don't let them unpublish it either.
148
+ *
149
+ * Filter hook: user_has_cap
150
+ *
151
+ * @param array $wp_sitecaps Array of user capabilities acknowledged for this request.
152
+ * @param array $reqd_caps Capability requirements
153
+ * @param array $args Additional arguments passed into user_has_cap filter
154
+ */
155
+ public function fltRegulateUnpublish($wp_sitecaps, $reqd_caps, $args)
156
+ {
157
+ if (!defined('REST_REQUEST') || !REST_REQUEST || !$this->is_posts_request || !$this->post_id || $this->skip_filtering) {
158
+ return $wp_sitecaps;
159
+ }
160
161
+ if ($reqd_cap = reset($reqd_caps)) {
162
+ // slight compromise for perf: apply this workaround only when cap->edit_published_posts property for post type follows typical pattern (edit_published_*)
163
+ if (0 === strpos($reqd_cap, 'edit_published_')) {
164
+ if ($this->params && !empty($this->params['status'])) {
165
+ $set_status = $this->fltPostStatus($this->params['status'], $this->post_id);
166
+ if ($set_status != $this->params['status']) {
167
+ unset($wp_sitecaps[$reqd_cap]);
168
+ }
169
+ }
170
+ }
171
+ }
172
+
173
+ return $wp_sitecaps;
174
+ }
175
+
176
+ /**
177
+ * If we are blocking Gutenberg "Switch to Draft" by capability filtering, also hide the button
178
+ *
179
+ * Action hook: 'admin_print_styles-post.php'
180
+ */
181
+ public function actAdminPrintScripts() {
182
+ global $current_user, $post;
183
+
184
+ if (empty($post) || !did_action('enqueue_block_editor_assets')) {
185
+ return;
186
+ }
187
+
188
+ $status_obj = get_post_status_object($post->post_status);
189
+
190
+ if (!$status_obj || (empty($status_obj->public) && empty($status_obj->private))) {
191
+ return;
192
+ }
193
+
194
+ $type_obj = get_post_type_object($post->post_type);
195
+ $this->skip_filtering = true;
196
+
197
+ if ($type_obj && !current_user_can($type_obj->cap->publish_posts) && current_user_can($type_obj->cap->edit_published_posts)): ?>
198
+ <style type="text/css">button.editor-post-switch-to-draft {display:none;}</style>
199
+ <?php endif;
200
+
201
+ $this->skip_filtering = false;
202
+ }
203
+
204
+ /**
205
+ * Log REST query parameters for possible use by subsequent filters
206
+ *
207
+ * Action hook: 'rest_pre_dispatch'
208
+ */
209
public function fltRestPreDispatch($rest_response, $rest_server, $request)
210
{
211
$method = $request->get_method();
232
}
233
234
$this->is_posts_request = true;
235
+ $this->is_view_method = in_array($method, [\WP_REST_Server::READABLE, 'GET']);
236
+ $this->params = $request->get_params();
237
+
238
break 2;
239
}
240
}
242
243
return $rest_response;
244
}
245
+
246
+ /**
247
+ * Determine the Post ID, if any, which this query pertains to
248
+ */
249
+ private function getPostID()
250
+ {
251
+ global $post;
252
+
253
+ if (defined('REST_REQUEST') && REST_REQUEST && $this->is_posts_request) {
254
+ return $this->post_id;
255
+ }
256
+
257
+ if (!empty($post) && is_object($post)) {
258
+ return ('auto-draft' == $post->post_status) ? 0 : $post->ID;
259
+ } elseif (isset($_REQUEST['post'])) {
260
+ return (int)$_REQUEST['post'];
261
+ } elseif (isset($_REQUEST['post_ID'])) {
262
+ return (int)$_REQUEST['post_ID'];
263
+ } elseif (isset($_REQUEST['post_id'])) {
264
+ return (int)$_REQUEST['post_id'];
265
+ }
266
+ }
267
}
includes/filters.php CHANGED
@@ -21,11 +21,21 @@ $cme_extensions = new CME_Extensions();
21
22
add_filter( 'map_meta_cap', '_cme_remap_term_meta_cap', 5, 4 );
23
24
if ( defined( 'WC_PLUGIN_FILE' ) ) {
25
require_once ( dirname(__FILE__) . '/filters-woocommerce.php' );
26
$cme_extensions->add( new CME_WooCommerce() );
27
}
28
29
if ( is_admin() ) {
30
global $pagenow;
31
if ( 'edit.php' == $pagenow ) {
@@ -36,6 +46,70 @@ if ( is_admin() ) {
36
37
add_filter('plugin_action_links_' . plugin_basename(CME_FILE), '_cme_fltPluginActionLinks', 10, 2);
38
39
// allow edit_terms, delete_terms, assign_terms capabilities to function separately from manage_terms
40
function _cme_remap_term_meta_cap ( $caps, $cap, $user_id, $args ) {
41
global $current_user, $cme_cap_helper;
@@ -59,6 +133,31 @@ function _cme_remap_term_meta_cap ( $caps, $cap, $user_id, $args ) {
59
60
// meta caps
61
switch ( $cap ) {
62
case 'edit_term':
63
case 'delete_term':
64
case 'assign_term':
21
22
add_filter( 'map_meta_cap', '_cme_remap_term_meta_cap', 5, 4 );
23
24
+ add_action( 'admin_head', '_cme_publishpress_roles_js');
25
+
26
if ( defined( 'WC_PLUGIN_FILE' ) ) {
27
require_once ( dirname(__FILE__) . '/filters-woocommerce.php' );
28
$cme_extensions->add( new CME_WooCommerce() );
29
}
30
31
+ if (!defined('CME_DISABLE_WP_EDIT_PUBLISHED_WORKAROUND')) {
32
+ global $wp_version;
33
+ if (version_compare($wp_version, '4.9.7', '>=')) { // avoid any issues with old REST API implementations
34
+ require_once (dirname(__FILE__) . '/filters-wp_rest_workarounds.php');
35
+ new PublishPress\Capabilities\WP_REST_Workarounds();
36
+ }
37
+ }
38
+
39
if ( is_admin() ) {
40
global $pagenow;
41
if ( 'edit.php' == $pagenow ) {
46
47
add_filter('plugin_action_links_' . plugin_basename(CME_FILE), '_cme_fltPluginActionLinks', 10, 2);
48
49
+
50
+ add_filter('pp_custom_status_list', 'cme_filter_custom_status_list', 10, 2);
51
+
52
+ function _cme_publishpress_roles_js() {
53
+ if (defined('PUBLISHPRESS_VERSION') && ((strpos($_SERVER['REQUEST_URI'], 'page=pp-manage-roles')))) {
54
+ require_once(dirname(__FILE__) . '/publishpress-roles.php');
55
+ CME_PublishPressRoles::scripts(); // @todo: .js
56
+ }
57
+ }
58
+
59
+ /**
60
+ * Filters the list of custom statuses
61
+ *
62
+ * @param array $custom_statuses
63
+ * @param WP_Post $post
64
+ *
65
+ * @return array
66
+ */
67
+ function cme_filter_custom_status_list($custom_statuses, $post)
68
+ {
69
+ if (!get_option('cme_custom_status_control')) {
70
+ return $custom_statuses;
71
+ }
72
+
73
+ if (class_exists('publishpress') && method_exists('publishpress', 'instance')) {
74
+ $publishpress = publishpress::instance();
75
+ } else {
76
+ global $publishpress;
77
+ }
78
+
79
+ if (empty($publishpress)) {
80
+ return $custom_statuses;
81
+ }
82
+
83
+ $filtered = [];
84
+ $option_group = 'global';
85
+
86
+ $default_status = $publishpress->custom_status->module->options->default_status;
87
+
88
+ if ( ! is_null($post)) {
89
+ // Adding a new post? Set the correct default status
90
+ if ('auto-draft' === $post->post_status) {
91
+ $post->post_status = $default_status;
92
+ }
93
+ }
94
+
95
+ foreach ($custom_statuses as &$status) {
96
+ $slug = str_replace('-', '_', $status->slug);
97
+
98
+ // Check if the user, or any of his user groups are capable to use the status. If not, but it is the
99
+ // current status, we still display it.
100
+ if (
101
+ current_user_can('status_change_' . $slug)
102
+ || (is_null($post) ? false : $status->slug === $post->post_status)
103
+ || $status->slug === $default_status
104
+ ) {
105
+ $filtered[] = $status;
106
+ }
107
+ }
108
+
109
+ return $filtered;
110
+ }
111
+
112
+
113
// allow edit_terms, delete_terms, assign_terms capabilities to function separately from manage_terms
114
function _cme_remap_term_meta_cap ( $caps, $cap, $user_id, $args ) {
115
global $current_user, $cme_cap_helper;
133
134
// meta caps
135
switch ( $cap ) {
136
+ // If detailed taxonomy capabilities are enabled for categories or tags, don't also require default capability for term assignment / deletion
137
+ case 'assign_categories':
138
+ if (in_array('category', $enabled_taxonomies)) {
139
+ $caps = array_diff($caps, ['edit_posts']);
140
+ }
141
+ break;
142
+
143
+ case 'assign_post_tags':
144
+ if (in_array('post_tag', $enabled_taxonomies)) {
145
+ $caps = array_diff($caps, ['edit_posts']);
146
+ }
147
+ break;
148
+
149
+ case 'delete_categories':
150
+ if (in_array('category', $enabled_taxonomies)) {
151
+ $caps = array_diff($caps, ['manage_categories']);
152
+ }
153
+ break;
154
+
155
+ case 'delete_post_tags':
156
+ if (in_array('post_tag', $enabled_taxonomies)) {
157
+ $caps = array_diff($caps, ['manage_categories']);
158
+ }
159
+ break;
160
+
161
case 'edit_term':
162
case 'delete_term':
163
case 'assign_term':
includes/functions-admin.php ADDED
@@ -0,0 +1,30 @@
1
+ <?php
2
+
3
+ // perf enhancement: display submenu links without loading framework and plugin code
4
+ function cme_submenus() {
5
+ $cap_name = ( is_super_admin() ) ? 'manage_capabilities' : 'restore_roles';
6
+
7
+ $permissions_title = __('Capabilities', 'capsman-enhanced');
8
+
9
+ $menu_order = 72;
10
+
11
+ if (defined('PUBLISHPRESS_PERMISSIONS_MENU_GROUPING')) {
12
+ foreach (get_option('active_plugins') as $plugin_file) {
13
+ if ( false !== strpos($plugin_file, 'publishpress.php') ) {
14
+ $menu_order = 27;
15
+ }
16
+ }
17
+ }
18
+
19
+ add_menu_page(
20
+ $permissions_title,
21
+ $permissions_title,
22
+ $cap_name,
23
+ 'capsman',
24
+ 'cme_fakefunc',
25
+ 'dashicons-admin-network',
26
+ $menu_order
27
+ );
28
+
29
+ add_submenu_page('capsman', __('Backup', 'capsman-enhanced'), __('Backup', 'capsman-enhanced'), $cap_name, 'capsman' . '-tool', 'cme_fakefunc');
30
+ }
includes/functions.php ADDED
@@ -0,0 +1,78 @@
1
+ <?php
2
+ function _cme_act_pp_active() {
3
+ if ( defined('PRESSPERMIT_VERSION') || ( defined('PPC_VERSION') && function_exists( 'pp_init_cap_caster' ) ) ) {
4
+ define( 'PRESSPERMIT_ACTIVE', true );
5
+ } else {
6
+ if ( defined('SCOPER_VERSION') || ( defined('PP_VERSION') && function_exists('pp_init_users_interceptor') ) ) {
7
+ define( 'OLD_PRESSPERMIT_ACTIVE', true );
8
+ }
9
+ }
10
+ }
11
+
12
+ function _cme_cap_helper() {
13
+ global $cme_cap_helper;
14
+
15
+ require_once ( dirname(__FILE__) . '/cap-helper.php' );
16
+ $cme_cap_helper = new CME_Cap_Helper();
17
+
18
+ add_action( 'registered_post_type', '_cme_post_type_late_reg', 5, 2 );
19
+ add_action( 'registered_taxonomy', '_cme_taxonomy_late_reg', 5, 2 );
20
+ }
21
+
22
+ function _cme_post_type_late_reg( $post_type, $type_obj ) {
23
+ global $cme_cap_helper;
24
+
25
+ if ( ! empty( $type_obj->public ) || ! empty( $type_obj->show_ui ) ) {
26
+ $cme_cap_helper->refresh();
27
+ }
28
+ }
29
+
30
+ function _cme_taxonomy_late_reg( $taxonomy, $tx_obj ) {
31
+ global $cme_cap_helper;
32
+
33
+ if ( ! empty( $tx_obj->public ) ) {
34
+ $cme_cap_helper->refresh();
35
+ }
36
+ }
37
+
38
+ function _cme_init() {
39
+ require_once ( dirname(__FILE__) . '/filters.php' );
40
+
41
+ load_plugin_textdomain('capsman-enhanced', false, dirname(__FILE__) . '/lang');
42
+ }
43
+
44
+ function cme_is_plugin_active($check_plugin_file) {
45
+ if ( ! $check_plugin_file )
46
+ return false;
47
+
48
+ $plugins = get_option('active_plugins');
49
+
50
+ foreach ( $plugins as $plugin_file ) {
51
+ if ( false !== strpos($plugin_file, $check_plugin_file) )
52
+ return $plugin_file;
53
+ }
54
+ }
55
+
56
+ // if a role is marked as hidden, also default it for use by Press Permit as a Pattern Role (when PP Collaborative Editing is activated and Advanced Settings enabled)
57
+ function _cme_pp_default_pattern_role( $role ) {
58
+ if ( ! $pp_role_usage = get_option( 'pp_role_usage' ) )
59
+ $pp_role_usage = array();
60
+
61
+ if ( empty( $pp_role_usage[$role] ) ) {
62
+ $pp_role_usage[$role] = 'pattern';
63
+ update_option( 'pp_role_usage', $pp_role_usage );
64
+ }
65
+ }
66
+
67
+ // deprecated
68
+ function capsman_get_pp_option( $option_basename ) {
69
+ return pp_capabilities_get_permissions_option($option_basename);
70
+ }
71
+
72
+ function pp_capabilities_get_permissions_option($option_basename) {
73
+ return (function_exists('presspermit')) ? presspermit()->getOption($option_basename) : pp_get_option($option_basename);
74
+ }
75
+
76
+ function pp_capabilities_update_permissions_option($option_basename, $option_val) {
77
+ function_exists('presspermit') ? presspermit()->updateOption($option_basename, $option_val) : pp_update_option($option_basename, $option_val);
78
+ }
includes/handler.php CHANGED
@@ -10,6 +10,8 @@ class CapsmanHandler
10
function processAdminGeneral( $post ) {
11
global $wp_roles;
12
13
// Create a new role.
14
if ( ! empty($post['CreateRole']) ) {
15
if ( $newrole = $this->createRole($post['create-name']) ) {
@@ -69,8 +71,7 @@ class CapsmanHandler
69
70
if ( $newname = $this->createNewName($post['capability-name']) ) {
71
$role->add_cap($newname['name']);
72
- $this->cm->message = __('New capability added to role.');
73
-
74
// for bbPress < 2.2, need to log customization of roles following bbPress activation
75
$plugins = ( function_exists( 'bbp_get_version' ) && version_compare( bbp_get_version(), '2.2', '<' ) ) ? array( 'bbpress.php' ) : array(); // back compat
76
@@ -82,10 +83,14 @@ class CapsmanHandler
82
83
global $wpdb;
84
$wpdb->query( "UPDATE $wpdb->options SET autoload = 'no' WHERE option_name = 'pp_customized_roles'" );
85
} else {
86
- $this->cm->message = __('Incorrect capability name.');
87
}
88
-
89
} elseif ( ! empty($post['update_filtered_types']) || ! empty($post['update_filtered_taxonomies']) || ! empty($post['update_detailed_taxonomies']) ) {
90
//if ( /* settings saved successfully on plugins_loaded action */ ) {
91
ak_admin_notify(__('Type / Taxonomy settings saved.', 'capsman-enhanced'));
@@ -93,15 +98,18 @@ class CapsmanHandler
93
// ak_admin_error(__('Error saving capability settings.', 'capsman-enhanced'));
94
//}
95
} else {
96
- // TODO: Implement exceptions. This must be a fatal error.
97
- ak_admin_error(__('Bad form received.', 'capsman-enhanced'));
98
}
99
100
if ( ! empty($newrole) && defined('PRESSPERMIT_ACTIVE') ) {
101
if ( ( ! empty($post['CreateRole']) && ! empty( $_REQUEST['new_role_pp_only'] ) ) || ( ! empty($post['CopyRole']) && ! empty( $_REQUEST['copy_role_pp_only'] ) ) ) {
102
- $pp_only = (array) capsman_get_pp_option( 'supplemental_role_defs' );
103
$pp_only[]= $newrole;
104
- pp_update_option( 'supplemental_role_defs', $pp_only );
105
_cme_pp_default_pattern_role( $newrole );
106
pp_refresh_options();
107
}
10
function processAdminGeneral( $post ) {
11
global $wp_roles;
12
13
+ do_action('publishpress-caps_process_update');
14
+
15
// Create a new role.
16
if ( ! empty($post['CreateRole']) ) {
17
if ( $newrole = $this->createRole($post['create-name']) ) {
71
72
if ( $newname = $this->createNewName($post['capability-name']) ) {
73
$role->add_cap($newname['name']);
74
+
75
// for bbPress < 2.2, need to log customization of roles following bbPress activation
76
$plugins = ( function_exists( 'bbp_get_version' ) && version_compare( bbp_get_version(), '2.2', '<' ) ) ? array( 'bbpress.php' ) : array(); // back compat
77
83
84
global $wpdb;
85
$wpdb->query( "UPDATE $wpdb->options SET autoload = 'no' WHERE option_name = 'pp_customized_roles'" );
86
+
87
+ $url = admin_url('admin.php?page=capsman&role=' . $post['role'] . '&added=1');
88
+ wp_redirect($url);
89
+ exit;
90
} else {
91
+ ak_admin_notify(__('Incorrect capability name.'));
92
}
93
+
94
} elseif ( ! empty($post['update_filtered_types']) || ! empty($post['update_filtered_taxonomies']) || ! empty($post['update_detailed_taxonomies']) ) {
95
//if ( /* settings saved successfully on plugins_loaded action */ ) {
96
ak_admin_notify(__('Type / Taxonomy settings saved.', 'capsman-enhanced'));
98
// ak_admin_error(__('Error saving capability settings.', 'capsman-enhanced'));
99
//}
100
} else {
101
+ if (!apply_filters('publishpress-caps_submission_ok', false)) {
102
+ ak_admin_error(__('Bad form received.', 'capsman-enhanced'));
103
+ }
104
}
105
106
if ( ! empty($newrole) && defined('PRESSPERMIT_ACTIVE') ) {
107
if ( ( ! empty($post['CreateRole']) && ! empty( $_REQUEST['new_role_pp_only'] ) ) || ( ! empty($post['CopyRole']) && ! empty( $_REQUEST['copy_role_pp_only'] ) ) ) {
108
+ $pp_only = (array) pp_capabilities_get_permissions_option( 'supplemental_role_defs' );
109
$pp_only[]= $newrole;
110
+
111
+ pp_capabilities_update_permissions_option('supplemental_role_defs', $pp_only);
112
+
113
_cme_pp_default_pattern_role( $newrole );
114
pp_refresh_options();
115
}
includes/manager.php CHANGED
@@ -4,25 +4,26 @@
4
* Plugin to create and manage roles and capabilities.
5
*
6
* @author Jordi Canals, Kevin Behrens
7
- * @copyright Copyright (C) 2009, 2010 Jordi Canals, (C) 2019 PublishPress
8
* @license GNU General Public License version 2
9
- * @link https://publishpress.com
10
*
11
-
12
- Copyright 2009, 2010 Jordi Canals <devel@jcanals.cat>
13
- Modifications Copyright 2019, PublishPress <help@publishpress.com>
14
-
15
- This program is free software; you can redistribute it and/or
16
- modify it under the terms of the GNU General Public License
17
- version 2 as published by the Free Software Foundation.
18
-
19
- This program is distributed in the hope that it will be useful,
20
- but WITHOUT ANY WARRANTY; without even the implied warranty of
21
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22
- GNU General Public License for more details.
23
-
24
- You should have received a copy of the GNU General Public License
25
- along with this program. If not, see <http://www.gnu.org/licenses/>.
26
*/
27
28
add_action( 'init', 'cme_update_pp_usage' ); // update early so resulting post type cap changes are applied for this request's UI construction
@@ -79,7 +80,7 @@ function _cme_is_read_removal_blocked( $role_name ) {
79
* Sets the main environment for all Capability Manager components.
80
*
81
* @author Jordi Canals, Kevin Behrens
82
- * @link https://publishpress.com
83
*/
84
class CapabilityManager
85
{
@@ -149,17 +150,17 @@ class CapabilityManager
149
if ( empty( $_REQUEST['page'] ) || ! in_array( $_REQUEST['page'], array( 'capsman', 'capsman-tool' ) ) )
150
return;
151
152
- wp_enqueue_style('revisionary-admin-common', $this->mod_url . '/common/css/pressshack-admin.css', [], CAPSMAN_ENH_VERSION);
153
154
- wp_register_style( $this->ID . 'framework_admin', $this->mod_url . '/framework/styles/admin.css', false, CAPSMAN_ENH_VERSION);
155
wp_enqueue_style( $this->ID . 'framework_admin');
156
157
- wp_register_style( $this->ID . '_admin', $this->mod_url . '/admin.css', false, CAPSMAN_ENH_VERSION);
158
wp_enqueue_style( $this->ID . '_admin');
159
160
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
161
$url = $this->mod_url . "/admin{$suffix}.js";
162
- wp_enqueue_script( 'cme_admin', $url, array('jquery'), CAPSMAN_VERSION, true );
163
wp_localize_script( 'cme_admin', 'cmeAdmin', array(
164
'negationCaption' => __( 'Explicity negate this capability by storing as disabled', 'capsman-enhanced' ),
165
'typeCapsNegationCaption' => __( 'Explicitly negate these capabilities by storing as disabled', 'capsman-enhanced' ),
@@ -184,8 +185,8 @@ class CapabilityManager
184
protected function moduleLoad ()
185
{
186
$old_version = get_option($this->ID . '_version');
187
- if ( version_compare( $old_version, CAPSMAN_ENH_VERSION, 'ne') ) {
188
- update_option($this->ID . '_version', CAPSMAN_ENH_VERSION);
189
$this->pluginUpdate();
190
}
191
@@ -264,25 +265,35 @@ class CapabilityManager
264
$this->setAdminCapability();
265
}
266
267
- add_action( 'admin_menu', array( &$this, 'cme_menu' ), 20 );
268
}
269
270
public function cme_menu() {
271
$cap_name = ( is_super_admin() ) ? 'manage_capabilities' : 'restore_roles';
272
- add_management_page(__('Capability Manager', 'capsman-enhanced'), __('Capability Manager', 'capsman-enhanced'), $cap_name, $this->ID . '-tool', array($this, 'backupTool'));
273
-
274
- if ( did_action( 'pp_admin_menu' ) ) { // Put Capabilities link on Permissions menu if Press Permit is active and user has access to it
275
- global $pp_admin;
276
- $menu_caption = ( defined('WPLANG') && WPLANG && ( 'en_EN' != WPLANG ) ) ? __('Capabilities', 'capsman-enhanced') : 'Role Capabilities';
277
- add_submenu_page( $pp_admin->get_menu('options'), __('Capability Manager', 'capsman-enhanced'), $menu_caption, 'manage_capabilities', $this->ID, array($this, 'generalManager') );
278
279
- } elseif(did_action('presspermit_admin_menu') && function_exists('presspermit')) {
280
- $menu_caption = ( defined('WPLANG') && WPLANG && ( 'en_EN' != WPLANG ) ) ? __('Capabilities', 'capsman-enhanced') : 'Role Capabilities';
281
- add_submenu_page( presspermit()->admin()->getMenuParams('options'), __('Capability Manager', 'capsman-enhanced'), $menu_caption, 'manage_capabilities', $this->ID, array($this, 'generalManager') );
282
-
283
- } else {
284
- add_users_page( __('Capability Manager', 'capsman-enhanced'), __('Capabilities', 'capsman-enhanced'), 'manage_capabilities', $this->ID, array($this, 'generalManager'));
285
- }
286
}
287
288
/**
@@ -429,6 +440,10 @@ class CapabilityManager
429
} elseif ( ! empty($_REQUEST['AddCap']) ) {
430
ak_admin_notify( $this->message );
431
}
432
}
433
434
$this->generateNames();
@@ -441,7 +456,13 @@ class CapabilityManager
441
}
442
443
if ( ! isset($this->current) ) { // By default, we manage the default role
444
- $this->current = get_option('default_role');
445
}
446
447
if ( ! in_array($this->current, $roles) ) { // Current role has been deleted.
@@ -598,3 +619,45 @@ class CapabilityManager
598
include ( dirname(CME_FILE) . '/includes/backup.php' );
599
}
600
}
4
* Plugin to create and manage roles and capabilities.
5
*
6
* @author Jordi Canals, Kevin Behrens
7
+ * @copyright Copyright (C) 2009, 2010 Jordi Canals, (C) 2020 PublishPress
8
* @license GNU General Public License version 2
9
+ * @link https://publishpress.com/
10
*
11
+ *
12
+ * Copyright 2009, 2010 Jordi Canals <devel@jcanals.cat>
13
+ *
14
+ * Modifications Copyright 2020, PublishPress <help@publishpress.com>
15
+ *
16
+ * This program is free software; you can redistribute it and/or
17
+ * modify it under the terms of the GNU General Public License
18
+ * version 2 as published by the Free Software Foundation.
19
+ *
20
+ * This program is distributed in the hope that it will be useful,
21
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ * GNU General Public License for more details.
24
+ *
25
+ * You should have received a copy of the GNU General Public License
26
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
27
*/
28
29
add_action( 'init', 'cme_update_pp_usage' ); // update early so resulting post type cap changes are applied for this request's UI construction
80
* Sets the main environment for all Capability Manager components.
81
*
82
* @author Jordi Canals, Kevin Behrens
83
+ * @link https://publishpress.com/
84
*/
85
class CapabilityManager
86
{
150
if ( empty( $_REQUEST['page'] ) || ! in_array( $_REQUEST['page'], array( 'capsman', 'capsman-tool' ) ) )
151
return;
152
153
+ wp_enqueue_style('cme-admin-common', $this->mod_url . '/common/css/pressshack-admin.css', [], PUBLISHPRESS_CAPS_VERSION);
154
155
+ wp_register_style( $this->ID . 'framework_admin', $this->mod_url . '/framework/styles/admin.css', false, PUBLISHPRESS_CAPS_VERSION);
156
wp_enqueue_style( $this->ID . 'framework_admin');
157
158
+ wp_register_style( $this->ID . '_admin', $this->mod_url . '/admin.css', false, PUBLISHPRESS_CAPS_VERSION);
159
wp_enqueue_style( $this->ID . '_admin');
160
161
$suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '.dev' : '';
162
$url = $this->mod_url . "/admin{$suffix}.js";
163
+ wp_enqueue_script( 'cme_admin', $url, array('jquery'), PUBLISHPRESS_CAPS_VERSION, true );
164
wp_localize_script( 'cme_admin', 'cmeAdmin', array(
165
'negationCaption' => __( 'Explicity negate this capability by storing as disabled', 'capsman-enhanced' ),
166
'typeCapsNegationCaption' => __( 'Explicitly negate these capabilities by storing as disabled', 'capsman-enhanced' ),
185
protected function moduleLoad ()
186
{
187
$old_version = get_option($this->ID . '_version');
188
+ if ( version_compare( $old_version, PUBLISHPRESS_CAPS_VERSION, 'ne') ) {
189
+ update_option($this->ID . '_version', PUBLISHPRESS_CAPS_VERSION);
190
$this->pluginUpdate();
191
}
192
265
$this->setAdminCapability();
266
}
267
268
+ add_action( 'admin_menu', array( &$this, 'cme_menu' ), 18 );
269
}
270
271
public function cme_menu() {
272
$cap_name = ( is_super_admin() ) ? 'manage_capabilities' : 'restore_roles';
273
274
+ $permissions_title = __('Capabilities', 'capsman-enhanced');
275
+
276
+ $menu_order = 72;
277
+
278
+ if (defined('PUBLISHPRESS_PERMISSIONS_MENU_GROUPING')) {
279
+ foreach (get_option('active_plugins') as $plugin_file) {
280
+ if ( false !== strpos($plugin_file, 'publishpress.php') ) {
281
+ $menu_order = 27;
282
+ }
283
+ }
284
+ }
285
+
286
+ add_menu_page(
287
+ $permissions_title,
288
+ $permissions_title,
289
+ $cap_name,
290
+ 'capsman',
291
+ array($this, 'generalManager'),
292
+ 'dashicons-admin-network',
293
+ $menu_order
294
+ );
295
+
296
+ add_submenu_page('capsman', __('Backup', 'capsman-enhanced'), __('Backup', 'capsman-enhanced'), $cap_name, $this->ID . '-tool', array($this, 'backupTool'));
297
}
298
299
/**
440
} elseif ( ! empty($_REQUEST['AddCap']) ) {
441
ak_admin_notify( $this->message );
442
}
443
+ } else {
444
+ if (!empty($_REQUEST['added'])) {
445
+ ak_admin_notify(__('New capability added to role.'));
446
+ }
447
}
448
449
$this->generateNames();
456
}
457
458
if ( ! isset($this->current) ) { // By default, we manage the default role
459
+ if (empty($_POST) && !empty($_REQUEST['role'])) {
460
+ $this->current = $_REQUEST['role'];
461
+ }
462
+ }
463
+
464
+ if (!isset($this->current) || !get_role($this->current)) {
465
+ $this->current = get_option('default_role');
466
}
467
468
if ( ! in_array($this->current, $roles) ) { // Current role has been deleted.
619
include ( dirname(CME_FILE) . '/includes/backup.php' );
620
}
621
}
622
+
623
+ function cme_publishpressFooter() {
624
+ ?>
625
+ <footer>
626
+
627
+ <div class="pp-rating">
628
+ <a href="https://wordpress.org/support/plugin/capability-manager-enhanced/reviews/#new-post" target="_blank" rel="noopener noreferrer">
629
+ <?php printf(
630
+ __('If you like %s, please leave us a %s rating. Thank you!', 'capsman-enhanced'),
631
+ '<strong>PublishPress Capabilities</strong>',
632
+ '<span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span>'
633
+ );
634
+ ?>
635
+ </a>
636
+ </div>
637
+
638
+ <hr>
639
+ <nav>
640
+ <ul>
641
+ <li><a href="https://publishpress.com/capability-manager/" target="_blank" rel="noopener noreferrer" title="<?php _e('About PublishPress Capabilities', 'capsman-enhanced');?>"><?php _e('About', 'capsman-enhanced');?>
642
+ </a></li>
643
+ <li><a href="https://publishpress.com/knowledge-base/how-to-use-capability-manager/" target="_blank" rel="noopener noreferrer" title="<?php _e('Capabilites Documentation', 'capsman-enhanced');?>"><?php _e('Documentation', 'capsman-enhanced');?>
644
+ </a></li>
645
+ <li><a href="https://publishpress.com/contact" target="_blank" rel="noopener noreferrer" title="<?php _e('Contact the PublishPress team', 'capsman-enhanced');?>"><?php _e('Contact', 'capsman-enhanced');?>
646
+ </a></li>
647
+ <li><a href="https://twitter.com/publishpresscom" target="_blank" rel="noopener noreferrer"><span class="dashicons dashicons-twitter"></span>
648
+ </a></li>
649
+ <li><a href="https://facebook.com/publishpress" target="_blank" rel="noopener noreferrer"><span class="dashicons dashicons-facebook"></span>
650
+ </a></li>
651
+ </ul>
652
+ </nav>
653
+
654
+ <div class="pp-pressshack-logo">
655
+ <a href="https://publishpress.com" target="_blank" rel="noopener noreferrer">
656
+
657
+ <img src="<?php echo plugins_url('', CME_FILE) . '/common/img/publishpress-logo.png';?>" />
658
+ </a>
659
+ </div>
660
+
661
+ </footer>
662
+ <?php
663
+ }
includes/network.php CHANGED
@@ -16,7 +16,7 @@ function _cme_new_blog( $new_blog_id ) {
16
$main_admin_caps = $admin_role->capabilities;
17
18
if ( defined('PRESSPERMIT_ACTIVE') )
19
- $main_pp_only = (array) capsman_get_pp_option( 'supplemental_role_defs' );
20
//$pp_only[]= $newrole;
21
22
foreach( $autocreate_roles as $role_name ) {
@@ -31,7 +31,7 @@ function _cme_new_blog( $new_blog_id ) {
31
32
if ( defined('PRESSPERMIT_ACTIVE') ) {
33
pp_refresh_options();
34
- $blog_pp_only = (array) capsman_get_pp_option( 'supplemental_role_defs' );
35
}
36
37
foreach( $main_site_caps as $role_name => $caps ) {
@@ -62,8 +62,9 @@ function _cme_new_blog( $new_blog_id ) {
62
}
63
}
64
65
- if ( defined('PRESSPERMIT_ACTIVE') )
66
- pp_update_option( 'supplemental_role_defs', $blog_pp_only );
67
68
restore_current_blog();
69
( method_exists( $wp_roles, 'for_site' ) ) ? $wp_roles->for_site() : $wp_roles->reinit();
16
$main_admin_caps = $admin_role->capabilities;
17
18
if ( defined('PRESSPERMIT_ACTIVE') )
19
+ $main_pp_only = (array) pp_capabilities_get_permissions_option( 'supplemental_role_defs' );
20
//$pp_only[]= $newrole;
21
22
foreach( $autocreate_roles as $role_name ) {
31
32
if ( defined('PRESSPERMIT_ACTIVE') ) {
33
pp_refresh_options();
34
+ $blog_pp_only = (array) pp_capabilities_get_permissions_option( 'supplemental_role_defs' );
35
}
36
37
foreach( $main_site_caps as $role_name => $caps ) {
62
}
63
}
64
65
+ if ( defined('PRESSPERMIT_ACTIVE') ) {
66
+ pp_capabilities_update_permissions_option('supplemental_role_defs', $blog_pp_only);
67
+ }
68
69
restore_current_blog();
70
( method_exists( $wp_roles, 'for_site' ) ) ? $wp_roles->for_site() : $wp_roles->reinit();
includes/pp-handler.php CHANGED
@@ -53,6 +53,10 @@ function _cme_update_pp_usage() {
53
update_option( 'cme_enabled_post_types', $value );
54
}
55
56
$updated = true;
57
}
58
@@ -64,14 +68,15 @@ function _cme_update_pp_usage() {
64
if ( defined( 'PRESSPERMIT_ACTIVE' ) ) {
65
if ( ! empty( $_REQUEST['SaveRole']) ) {
66
if ( ! empty( $_REQUEST['role'] ) ) {
67
- $pp_only = (array) capsman_get_pp_option( 'supplemental_role_defs' );
68
69
if ( empty($_REQUEST['pp_only_role']) )
70
$pp_only = array_diff( $pp_only, array($_REQUEST['role']) );
71
else
72
$pp_only[]= $_REQUEST['role'];
73
74
- pp_update_option( 'supplemental_role_defs', array_unique($pp_only) );
75
_cme_pp_default_pattern_role( $_REQUEST['role'] );
76
}
77
}
53
update_option( 'cme_enabled_post_types', $value );
54
}
55
56
+ if (defined('PRESSPERMIT_ACTIVE') && in_array($option_basename, ['enabled_post_types', 'enabled_taxonomies'])) {
57
+ pp_capabilities_update_permissions_option($option_basename, $value);
58
+ }
59
+
60
$updated = true;
61
}
62
68
if ( defined( 'PRESSPERMIT_ACTIVE' ) ) {
69
if ( ! empty( $_REQUEST['SaveRole']) ) {
70
if ( ! empty( $_REQUEST['role'] ) ) {
71
+ $pp_only = (array) pp_capabilities_get_permissions_option( 'supplemental_role_defs' );
72
73
if ( empty($_REQUEST['pp_only_role']) )
74
$pp_only = array_diff( $pp_only, array($_REQUEST['role']) );
75
else
76
$pp_only[]= $_REQUEST['role'];
77
78
+ pp_capabilities_update_permissions_option('supplemental_role_defs', array_unique($pp_only));
79
+
80
_cme_pp_default_pattern_role( $_REQUEST['role'] );
81
}
82
}
includes/pp-ui.php CHANGED
@@ -30,17 +30,17 @@ class Capsman_PP_UI {
30
}
31
32
function show_capability_hints( $default ) {
33
- if ( capsman_get_pp_option('display_hints') ) {
34
$cme_id = 'capsman';
35
36
- echo '<ul class="ul-disc" style="margin-top:10px">';
37
38
$pp_prefix = ( defined( 'PRESSPERMIT_VERSION') ) ? 'presspermit' : 'pp';
39
40
if ( defined( 'PPCE_VERSION' ) || ! defined( 'PRESSPERMIT_ACTIVE' ) || in_array( $default, array( 'subscriber', 'contributor', 'author', 'editor' ) ) ) {
41
echo '<li>';
42
if ( defined( 'PPCE_VERSION' ) || ! defined( 'PRESSPERMIT_ACTIVE' ) ) {
43
- if ( capsman_get_pp_option( 'advanced_options' ) )
44
$parenthetical = ' (' . sprintf( __( 'see %1$sRole Usage%2$s: "Pattern Roles"', 'capsman-enhanced' ), "<a href='" . admin_url("admin.php?page={$pp_prefix}-role-usage") . "'>", '</a>' ) . ')';
45
else
46
$parenthetical = ' (' . sprintf( __( 'activate %1$sAdvanced settings%2$s, see Role Usage', 'capsman-enhanced' ), "<a href='" . admin_url("admin.php?page={$pp_prefix}-settings&pp_tab=advanced") . "'>", '</a>' ). ')';
@@ -48,7 +48,7 @@ class Capsman_PP_UI {
48
$parenthetical = '';
49
50
if ( defined( 'PRESSPERMIT_ACTIVE' ) )
51
- printf( __( '"Posts" capabilities selected here also define type-specific role assignment for Permission Groups%s.', $cme_id ), $parenthetical ) ;
52
else
53
printf( __( '"Posts" capabilities selected here also define type-specific role assignment for Permit Groups%s.', $cme_id ), $parenthetical ) ;
54
@@ -59,7 +59,7 @@ class Capsman_PP_UI {
59
if ( defined( 'PRESSPERMIT_ACTIVE' ) )
60
if ( defined( 'PPS_VERSION' ) )
61
$status_hint = sprintf( __( 'Capabilities for custom statuses can be manually added here. (See %sPermissions > Post Statuses%s for applicable names). %sSupplemental status-specific roles%s are usually more convenient, though.', $cme_id ), "<a href='" . admin_url("admin.php?page={$pp_prefix}-statuses&show_caps=1") . "'>", '</a>', "<a href='" . admin_url("admin.php?page={$pp_prefix}-groups") . "'>", '</a>' ) ;
62
- elseif ( capsman_get_pp_option( 'display_extension_hints' ) )
63
$status_hint = sprintf( __( 'Capabilities for custom statuses can be manually added here. Or activate the PP Custom Post Statuses extension to assign status-specific supplemental roles.', $cme_id ), "<a href='" . admin_url("admin.php?page={$pp_prefix}-role-usage") . "'>", '</a>' ) ;
64
65
elseif ( defined( 'PP_VERSION' ) )
@@ -80,7 +80,7 @@ class Capsman_PP_UI {
80
<div style="float:right">
81
<?php
82
pp_refresh_options();
83
- $pp_only = (array) capsman_get_pp_option( 'supplemental_role_defs' );
84
$checked = ( in_array( $default, $pp_only ) ) ? 'checked="checked"': '';
85
?>
86
<label for="pp_only_role" title="<?php _e('Make role available for supplemental assignment to Permission Groups only', 'capsman-enhanced');?>"><input type="checkbox" name="pp_only_role" id="pp_only_role" value="1" <?php echo $checked;?>> <?php _e('hidden role', 'capsman-enhanced'); ?> </label>
@@ -100,7 +100,7 @@ class Capsman_PP_UI {
100
$caption = __( 'Ensure permissions can be controlled separately from other post types.', 'capsman-enhanced' );
101
echo "<p class='cme-hint'>$caption</p>";
102
103
- if ( defined( 'PRESSPERMIT_ACTIVE' ) && capsman_get_pp_option( 'display_hints' ) ) :?>
104
<div class="cme-subtext" style="margin-top:0">
105
<?php /*_e( '(PP Filtered Post Types, Taxonomies)', 'capsman-enhanced' ); */?>
106
</div>
30
}
31
32
function show_capability_hints( $default ) {
33
+ if ( pp_capabilities_get_permissions_option('display_hints') ) {
34
$cme_id = 'capsman';
35
36
+ echo '<ul class="ul-disc publishpress-caps-extra-hints" style="margin-top:10px;display:none">';
37
38
$pp_prefix = ( defined( 'PRESSPERMIT_VERSION') ) ? 'presspermit' : 'pp';
39
40
if ( defined( 'PPCE_VERSION' ) || ! defined( 'PRESSPERMIT_ACTIVE' ) || in_array( $default, array( 'subscriber', 'contributor', 'author', 'editor' ) ) ) {
41
echo '<li>';
42
if ( defined( 'PPCE_VERSION' ) || ! defined( 'PRESSPERMIT_ACTIVE' ) ) {
43
+ if ( pp_capabilities_get_permissions_option( 'advanced_options' ) )
44
$parenthetical = ' (' . sprintf( __( 'see %1$sRole Usage%2$s: "Pattern Roles"', 'capsman-enhanced' ), "<a href='" . admin_url("admin.php?page={$pp_prefix}-role-usage") . "'>", '</a>' ) . ')';
45
else
46
$parenthetical = ' (' . sprintf( __( 'activate %1$sAdvanced settings%2$s, see Role Usage', 'capsman-enhanced' ), "<a href='" . admin_url("admin.php?page={$pp_prefix}-settings&pp_tab=advanced") . "'>", '</a>' ). ')';
48
$parenthetical = '';
49
50
if ( defined( 'PRESSPERMIT_ACTIVE' ) )
51
+ printf( __( '"Posts" capabilities selected here also define type-specific role assignment for Permission Groups%s.', $cme_id ), $parenthetical );
52
else
53
printf( __( '"Posts" capabilities selected here also define type-specific role assignment for Permit Groups%s.', $cme_id ), $parenthetical ) ;
54
59
if ( defined( 'PRESSPERMIT_ACTIVE' ) )
60
if ( defined( 'PPS_VERSION' ) )
61
$status_hint = sprintf( __( 'Capabilities for custom statuses can be manually added here. (See %sPermissions > Post Statuses%s for applicable names). %sSupplemental status-specific roles%s are usually more convenient, though.', $cme_id ), "<a href='" . admin_url("admin.php?page={$pp_prefix}-statuses&show_caps=1") . "'>", '</a>', "<a href='" . admin_url("admin.php?page={$pp_prefix}-groups") . "'>", '</a>' ) ;
62
+ elseif ( pp_capabilities_get_permissions_option( 'display_extension_hints' ) )
63
$status_hint = sprintf( __( 'Capabilities for custom statuses can be manually added here. Or activate the PP Custom Post Statuses extension to assign status-specific supplemental roles.', $cme_id ), "<a href='" . admin_url("admin.php?page={$pp_prefix}-role-usage") . "'>", '</a>' ) ;
64
65
elseif ( defined( 'PP_VERSION' ) )
80
<div style="float:right">
81
<?php
82
pp_refresh_options();
83
+ $pp_only = (array) pp_capabilities_get_permissions_option( 'supplemental_role_defs' );
84
$checked = ( in_array( $default, $pp_only ) ) ? 'checked="checked"': '';
85
?>
86
<label for="pp_only_role" title="<?php _e('Make role available for supplemental assignment to Permission Groups only', 'capsman-enhanced');?>"><input type="checkbox" name="pp_only_role" id="pp_only_role" value="1" <?php echo $checked;?>> <?php _e('hidden role', 'capsman-enhanced'); ?> </label>
100
$caption = __( 'Ensure permissions can be controlled separately from other post types.', 'capsman-enhanced' );
101
echo "<p class='cme-hint'>$caption</p>";
102
103
+ if ( defined( 'PRESSPERMIT_ACTIVE' ) && pp_capabilities_get_permissions_option( 'display_hints' ) ) :?>
104
<div class="cme-subtext" style="margin-top:0">
105
<?php /*_e( '(PP Filtered Post Types, Taxonomies)', 'capsman-enhanced' ); */?>
106
</div>
includes/publishpress-roles.php ADDED
@@ -0,0 +1,36 @@
1
+ <?php
2
+ class CME_PublishPressRoles {
3
+ function scripts() {
4
+ ?>
5
+ <script type="text/javascript">
6
+ /* <![CDATA[ */
7
+ jQuery(document).ready(function ($) {
8
+ $('#the-list').children('tr').each(function(index, e) {
9
+ if (!$(e).find('td.display_name div.row-actions span.edit-capabilities').count) {
10
+ var link = '';
11
+ var is_administrator_role = ('role-administrator' == $(e).attr('id'));
12
+ var role_name = $(e).attr('id');
13
+ role_name = role_name.replace('role-', '');
14
+
15
+ if (is_administrator_role) {
16
+ link += ' | ';
17
+ }
18
+
19
+ link += '<a href="<?php echo admin_url('admin.php?page=capsman');?>' + '&role=' + role_name + '">' + 'Capabilities' + '</a> ';
20
+
21
+ if (!is_administrator_role) {
22
+ link += '| ';
23
+ }
24
+
25
+ $(e).find('td.display_name div.row-actions span.edit-role').after(' <span class="edit edit-capabilities">' + link + '</span>');
26
+ }
27
+ });
28
+ });
29
+ /* ]]> */
30
+ </script>
31
+ <style type="text/css">
32
+
33
+ </style>
34
+ <?php
35
+ }
36
+ }
lang/capsman.mo CHANGED
Binary file
lang/capsman.po CHANGED
@@ -2,300 +2,281 @@ msgid ""
2
msgstr ""
3
"Project-Id-Version: Capability Manager Enhanced\n"
4
"Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2019-10-24 16:55-0500\n"
6
- "PO-Revision-Date: 2019-10-24 16:55-0500\n"
7
"Last-Translator: Kevin Behrens <kevin@publishpress.com>\n"
8
"Language-Team: PublishPress <help@publishpress.com>\n"
9
"MIME-Version: 1.0\n"
10
"Content-Type: text/plain; charset=UTF-8\n"
11
"Content-Transfer-Encoding: 8bit\n"
12
"X-Poedit-KeywordsList: __;_e;_c;__ngettext;_n;pp_po_trigger;_x\n"
13
- "X-Poedit-Basepath: F:\\www\\wp50\\wp-content\\plugins\\capability-manager-enhanced\n"
14
"X-Poedit-Language: English\n"
15
"X-Poedit-Country: UNITED STATES\n"
16
"X-Poedit-SourceCharset: utf-8\n"
17
- "X-Poedit-SearchPath-0: F:\\www\\wp50\\wp-content\\plugins\\capability-manager-enhanced\n"
18
- "X-Poedit-SearchPath-1: F:\\www\\wp50\\wp-content\\plugins\\capability-manager-enhanced\\includes\n"
19
20
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/capsman-enhanced.php:36
21
- msgid "<strong>Error:</strong> Capability Manager Extended cannot function because another copy of Capability Manager is active."
22
msgstr ""
23
24
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/capsman-enhanced.php:54
25
msgid "Warning:"
26
msgstr ""
27
28
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/capsman-enhanced.php:55
29
#, php-format
30
msgid "The active plugin %s is not compatible with your PHP version."
31
msgstr ""
32
33
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/capsman-enhanced.php:57
34
#, php-format
35
msgid "%s is required for this plugin."
36
msgstr ""
37
38
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/capsman-enhanced.php:143
39
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/capsman-enhanced.php:148
40
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/capsman-enhanced.php:152
41
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/capsman-enhanced.php:155
42
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/manager.php:272
43
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/manager.php:277
44
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/manager.php:281
45
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/manager.php:284
46
- msgid "Capability Manager"
47
- msgstr ""
48
-
49
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/capsman-enhanced.php:147
50
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/capsman-enhanced.php:151
51
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/capsman-enhanced.php:155
52
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/manager.php:276
53
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/manager.php:280
54
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/manager.php:284
55
- msgid "Capabilities"
56
- msgstr ""
57
-
58
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/framework/lib/formating.php:40
59
msgid "Settings saved."
60
msgstr ""
61
62
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:36
63
#, php-format
64
msgid "Warning: This role cannot access the dashboard without the read capability. %1$sClick here to fix this now%2$s."
65
msgstr ""
66
67
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:61
68
- msgid "Roles and Capabilities"
69
msgstr ""
70
71
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:70
72
#, php-format
73
msgid "Capabilities for %s"
74
msgstr ""
75
76
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:73
77
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:1017
78
msgid "Save Changes"
79
msgstr ""
80
81
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:82
82
msgid "<strong>Note:</strong> Capability changes <strong>remain in the database</strong> after plugin deactivation."
83
msgstr ""
84
85
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:84
86
#, php-format
87
- msgid "Thanks for using the %1$sPublishPress%2$s family of professional publishing tools."
88
msgstr ""
89
90
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:110
91
- msgid "PressPermit Pro"
92
msgstr ""
93
94
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:112
95
msgid "Automatically define type-specific capabilities for your custom post types and taxonomies"
96
msgstr ""
97
98
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:116
99
msgid "Assign standard WP roles supplementally for a specific post type"
100
msgstr ""
101
102
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:120
103
msgid "Assign custom WP roles supplementally for a specific post type <em>(Pro)</em>"
104
msgstr ""
105
106
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:124
107
msgid "Customize reading permissions per-category or per-post"
108
msgstr ""
109
110
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:128
111
msgid "Customize editing permissions per-category or per-post <em>(Pro)</em>"
112
msgstr ""
113
114
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:132
115
msgid "Custom Post Visibility statuses, fully implemented throughout wp-admin <em>(Pro)</em>"
116
msgstr ""
117
118
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:136
119
msgid "Custom Moderation statuses for access-controlled, multi-step publishing workflow <em>(Pro)</em>"
120
msgstr ""
121
122
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:140
123
msgid "Regulate permissions for Edit Flow post statuses <em>(Pro)</em>"
124
msgstr ""
125
126
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:144
127
msgid "Customize the moderated editing of published content with Revisionary or Post Forking <em>(Pro)</em>"
128
msgstr ""
129
130
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:148
131
msgid "Grant Spectator, Participant or Moderator access to specific bbPress forums <em>(Pro)</em>"
132
msgstr ""
133
134
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:152
135
msgid "Grant supplemental content permissions to a BuddyPress group <em>(Pro)</em>"
136
msgstr ""
137
138
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:156
139
msgid "WPML integration to mirror permissions to translations <em>(Pro)</em>"
140
msgstr ""
141
142
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:160
143
msgid "Member support forum"
144
msgstr ""
145
146
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:167
147
#, php-format
148
msgid "%1$sgrab%2$s %3$s"
149
msgstr ""
150
151
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:167
152
#, php-format
153
msgid "%s (free install)"
154
msgstr ""
155
156
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:169
157
#, php-format
158
msgid "%1$sbuy%2$s %3$s"
159
msgstr ""
160
161
- #: F:\www\wp50\wp-content\plugins\capability-manager-enhanced/includes/admin.php:169