Version Description
- Fixed : Non-administrators' user editing capabilities were blocked if Press Permit Core was also active
- Fixed : Non-administrators could not edit other users with their role (define constant CME_LEGACY_USER_EDIT_FILTER to retain previous behavior)
- Fixed : Non-administrators could not assign their role to other users (define constant CME_LEGACY_USER_EDIT_FILTER to retain previous behavior)
- Lang : Changed text domain for language pack conformance
Download this release
Release Info
Developer | kevinB |
Plugin | Capability Manager Enhanced |
Version | 1.5.4 |
Comparing to | |
See all releases |
Code changes from version 1.5.3 to 1.5.4
- capsman-enhanced.php +22 -20
- framework/classes/abstract/plugin.php +7 -7
- framework/lib/formating.php +1 -1
- framework/lib/themes-agapetry.php +8 -8
- includes/admin.php +59 -60
- includes/backup-handler.php +7 -7
- includes/backup.php +10 -10
- includes/handler.php +12 -12
- includes/manager.php +49 -30
- includes/pp-ui.php +7 -7
- lang/capsman.pot +1 -1
- readme.txt +8 -2
capsman-enhanced.php
CHANGED
@@ -3,9 +3,11 @@
|
|
3 |
Plugin Name: Capability Manager Enhanced
|
4 |
Plugin URI: http://presspermit.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.5.
|
7 |
Author: Jordi Canals, Kevin Behrens
|
8 |
Author URI: http://agapetry.net
|
|
|
|
|
9 |
*/
|
10 |
|
11 |
/**
|
@@ -32,12 +34,12 @@ Author URI: http://agapetry.net
|
|
32 |
*/
|
33 |
|
34 |
if ( ! defined( 'CAPSMAN_VERSION' ) ) {
|
35 |
-
define( 'CAPSMAN_VERSION', '1.5.
|
36 |
-
define( 'CAPSMAN_ENH_VERSION', '1.5.
|
37 |
}
|
38 |
|
39 |
if ( cme_is_plugin_active( 'capsman.php' ) ) {
|
40 |
-
$message = __( '<strong>Error:</strong> Capability Manager Extended cannot function because another copy of Capability Manager is active.', 'capsman' );
|
41 |
add_action('admin_notices', create_function('', 'echo \'<div id="message" class="error fade" style="color: black">' . $message . '</div>\';'));
|
42 |
return;
|
43 |
} else {
|
@@ -53,12 +55,12 @@ if ( cme_is_plugin_active( 'capsman.php' ) ) {
|
|
53 |
*/
|
54 |
function _cman_php_warning() {
|
55 |
$data = get_plugin_data(__FILE__);
|
56 |
-
load_plugin_textdomain('capsman', false, basename(dirname(__FILE__)) .'/lang');
|
57 |
|
58 |
-
echo '<div class="error"><p><strong>' . __('Warning:', 'capsman') . '</strong> '
|
59 |
-
. sprintf(__('The active plugin %s is not compatible with your PHP version.', 'capsman') .'</p><p>',
|
60 |
'«' . $data['Name'] . ' ' . $data['Version'] . '»')
|
61 |
-
. sprintf(__('%s is required for this plugin.', 'capsman'), 'PHP-5 ')
|
62 |
. '</p></div>';
|
63 |
}
|
64 |
|
@@ -88,7 +90,7 @@ if ( cme_is_plugin_active( 'capsman.php' ) ) {
|
|
88 |
add_action( 'admin_enqueue_scripts', '_cme_pp_scripts' );
|
89 |
}
|
90 |
} else {
|
91 |
-
load_plugin_textdomain('capsman', false, basename(dirname(__FILE__)) .'/lang');
|
92 |
add_action( 'admin_menu', 'cme_submenus' );
|
93 |
}
|
94 |
}
|
@@ -109,20 +111,20 @@ function _cme_pp_scripts() {
|
|
109 |
|
110 |
// perf enchancement: display submenu links without loading framework and plugin code
|
111 |
function cme_submenus() {
|
112 |
-
|
113 |
-
|
114 |
-
} else {
|
115 |
-
$menu_caption = ( defined('WPLANG') && WPLANG ) ? __('Capabilities', 'capsman') : 'Role Capabilities';
|
116 |
-
add_users_page( __('Capability Manager', 'capsman'), $menu_caption, 'manage_capabilities', 'capsman', 'cme_fakefunc');
|
117 |
-
}
|
118 |
-
|
119 |
$cap_name = ( is_super_admin() ) ? 'manage_capabilities' : 'restore_roles';
|
120 |
-
add_management_page(__('Capability Manager', 'capsman'), __('Capability Manager', 'capsman'), $cap_name, 'capsman' . '-tool', 'cme_fakefunc');
|
121 |
}
|
122 |
|
123 |
-
function
|
124 |
-
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
126 |
}
|
127 |
|
128 |
function cme_is_plugin_active($check_plugin_file) {
|
3 |
Plugin Name: Capability Manager Enhanced
|
4 |
Plugin URI: http://presspermit.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.5.4
|
7 |
Author: Jordi Canals, Kevin Behrens
|
8 |
Author URI: http://agapetry.net
|
9 |
+
Text Domain: capsman-enhanced
|
10 |
+
Domain Path: /lang/
|
11 |
*/
|
12 |
|
13 |
/**
|
34 |
*/
|
35 |
|
36 |
if ( ! defined( 'CAPSMAN_VERSION' ) ) {
|
37 |
+
define( 'CAPSMAN_VERSION', '1.5.4' );
|
38 |
+
define( 'CAPSMAN_ENH_VERSION', '1.5.4' );
|
39 |
}
|
40 |
|
41 |
if ( cme_is_plugin_active( 'capsman.php' ) ) {
|
42 |
+
$message = __( '<strong>Error:</strong> Capability Manager Extended cannot function because another copy of Capability Manager is active.', 'capsman-enhanced' );
|
43 |
add_action('admin_notices', create_function('', 'echo \'<div id="message" class="error fade" style="color: black">' . $message . '</div>\';'));
|
44 |
return;
|
45 |
} else {
|
55 |
*/
|
56 |
function _cman_php_warning() {
|
57 |
$data = get_plugin_data(__FILE__);
|
58 |
+
load_plugin_textdomain('capsman-enhanced', false, basename(dirname(__FILE__)) .'/lang');
|
59 |
|
60 |
+
echo '<div class="error"><p><strong>' . __('Warning:', 'capsman-enhanced') . '</strong> '
|
61 |
+
. sprintf(__('The active plugin %s is not compatible with your PHP version.', 'capsman-enhanced') .'</p><p>',
|
62 |
'«' . $data['Name'] . ' ' . $data['Version'] . '»')
|
63 |
+
. sprintf(__('%s is required for this plugin.', 'capsman-enhanced'), 'PHP-5 ')
|
64 |
. '</p></div>';
|
65 |
}
|
66 |
|
90 |
add_action( 'admin_enqueue_scripts', '_cme_pp_scripts' );
|
91 |
}
|
92 |
} else {
|
93 |
+
load_plugin_textdomain('capsman-enhanced', false, basename(dirname(__FILE__)) .'/lang');
|
94 |
add_action( 'admin_menu', 'cme_submenus' );
|
95 |
}
|
96 |
}
|
111 |
|
112 |
// perf enchancement: display submenu links without loading framework and plugin code
|
113 |
function cme_submenus() {
|
114 |
+
add_action( 'admin_menu', '_cme_menu_item', 20 );
|
115 |
+
|
|
|
|
|
|
|
|
|
|
|
116 |
$cap_name = ( is_super_admin() ) ? 'manage_capabilities' : 'restore_roles';
|
117 |
+
add_management_page(__('Capability Manager', 'capsman-enhanced'), __('Capability Manager', 'capsman-enhanced'), $cap_name, 'capsman' . '-tool', 'cme_fakefunc');
|
118 |
}
|
119 |
|
120 |
+
function _cme_menu_item() {
|
121 |
+
if ( did_action( 'pp_admin_menu' ) ) { // Put Capabilities link on Permissions menu if Press Permit is active and user has access to it
|
122 |
+
global $pp_admin;
|
123 |
+
add_submenu_page( $pp_admin->get_menu('options'), __('Capability Manager', 'capsman-enhanced'), __('Role Capabilities', 'capsman-enhanced'), 'manage_capabilities', 'capsman', 'cme_fakefunc' );
|
124 |
+
} else {
|
125 |
+
$menu_caption = ( defined('WPLANG') && WPLANG ) ? __('Capabilities', 'capsman-enhanced') : 'Role Capabilities';
|
126 |
+
add_users_page( __('Capability Manager', 'capsman-enhanced'), $menu_caption, 'manage_capabilities', 'capsman', 'cme_fakefunc');
|
127 |
+
}
|
128 |
}
|
129 |
|
130 |
function cme_is_plugin_active($check_plugin_file) {
|
framework/classes/abstract/plugin.php
CHANGED
@@ -176,7 +176,7 @@ abstract class akPluginAbstract
|
|
176 |
*/
|
177 |
final function pluginsInit ()
|
178 |
{
|
179 |
-
load_plugin_textdomain(
|
180 |
}
|
181 |
|
182 |
/**
|
@@ -221,12 +221,12 @@ abstract class akPluginAbstract
|
|
221 |
$url = $this->mod_url . "/admin{$suffix}.js";
|
222 |
wp_enqueue_script( 'cme_admin', $url, array('jquery'), CAPSMAN_VERSION, true );
|
223 |
wp_localize_script( 'cme_admin', 'cmeAdmin', array(
|
224 |
-
'negationCaption' => __( 'Explicity negate this capability by storing as disabled', 'capsman' ),
|
225 |
-
'typeCapsNegationCaption' => __( 'Explicitly negate these capabilities by storing as disabled', 'capsman' ),
|
226 |
-
'typeCapUnregistered' => __( 'Post type registration does not define this capability distinctly', 'capsman' ),
|
227 |
-
'capNegated' => __( 'This capability is explicitly negated. Click to add/remove normally.', 'capsman' ),
|
228 |
-
'chkCaption' => __( 'Add or remove this capability from the WordPress role', 'capsman' ),
|
229 |
-
'switchableCaption' => __( 'Add or remove capability from the role normally', 'capsman' ) )
|
230 |
);
|
231 |
}
|
232 |
|
176 |
*/
|
177 |
final function pluginsInit ()
|
178 |
{
|
179 |
+
load_plugin_textdomain('capsman-enhanced', false, basename(dirname($this->mod_file)) . '/lang');
|
180 |
}
|
181 |
|
182 |
/**
|
221 |
$url = $this->mod_url . "/admin{$suffix}.js";
|
222 |
wp_enqueue_script( 'cme_admin', $url, array('jquery'), CAPSMAN_VERSION, true );
|
223 |
wp_localize_script( 'cme_admin', 'cmeAdmin', array(
|
224 |
+
'negationCaption' => __( 'Explicity negate this capability by storing as disabled', 'capsman-enhanced' ),
|
225 |
+
'typeCapsNegationCaption' => __( 'Explicitly negate these capabilities by storing as disabled', 'capsman-enhanced' ),
|
226 |
+
'typeCapUnregistered' => __( 'Post type registration does not define this capability distinctly', 'capsman-enhanced' ),
|
227 |
+
'capNegated' => __( 'This capability is explicitly negated. Click to add/remove normally.', 'capsman-enhanced' ),
|
228 |
+
'chkCaption' => __( 'Add or remove this capability from the WordPress role', 'capsman-enhanced' ),
|
229 |
+
'switchableCaption' => __( 'Add or remove capability from the role normally', 'capsman-enhanced' ) )
|
230 |
);
|
231 |
}
|
232 |
|
framework/lib/formating.php
CHANGED
@@ -37,7 +37,7 @@ function ak_admin_notify( $message = '' )
|
|
37 |
{
|
38 |
if ( is_admin() ) {
|
39 |
if ( empty($message) ) {
|
40 |
-
$message = __('Settings saved.', '
|
41 |
}
|
42 |
echo '<div id="message" class="updated fade"><p><strong>' . $message . '</strong></p></div>';
|
43 |
}
|
37 |
{
|
38 |
if ( is_admin() ) {
|
39 |
if ( empty($message) ) {
|
40 |
+
$message = __('Settings saved.', 'capsman-enhanced');
|
41 |
}
|
42 |
echo '<div id="message" class="updated fade"><p><strong>' . $message . '</strong></p></div>';
|
43 |
}
|
framework/lib/themes-agapetry.php
CHANGED
@@ -6,11 +6,11 @@ function agp_admin_authoring( $mod_id = '' ) {
|
|
6 |
<dt>Capability Manager</dt>
|
7 |
<dd>
|
8 |
<ul>
|
9 |
-
<li><a href="http://agapetry.com" class="capsman" target="_blank"><?php _e('Plugin Homepage', 'capsman'); ?></a></li>
|
10 |
-
<li><a href="http://presspermit.com" class="docs" target="_blank"><?php _e('Documentation', 'capsman'); ?></a></li>
|
11 |
-
<li><a href="http://agapetry.net/forum" class="help" target="_blank"><?php _e('Support Forum', 'capsman'); ?></a></li>
|
12 |
-
<li><a href="http://agapetry.com" class="home" target="_blank"><?php _e('Author Homepage', 'capsman')?></a></li>
|
13 |
-
<li><a href="http://agapetry.com" class="donate" target="_blank"><?php _e('Help donating', 'capsman')?></a></li>
|
14 |
</ul>
|
15 |
</dd>
|
16 |
</dl>
|
@@ -20,11 +20,11 @@ function agp_admin_authoring( $mod_id = '' ) {
|
|
20 |
function agp_admin_footer( $mod_id = '' ) {
|
21 |
?>
|
22 |
<p class="footer">
|
23 |
-
<a href="http://wordpress.org/extend/plugins/capability-manager-enhanced"><?php printf( __( 'Capability Manager Enhanced %s', 'capsman' ), CAPSMAN_ENH_VERSION );?></a>
|
24 |
-
| © <?php _e( 'Copyright 2010 Jordi Canals', 'capsman' );?>
|
25 |
|
|
26 |
<?php
|
27 |
-
printf( __( 'Modifications © Copyright %1$s %2$s', 'capsman' ), '2012-2015', '<a href="http://agapetry.com">Kevin Behrens</a>' );?>
|
28 |
</p>
|
29 |
<?php
|
30 |
}
|
6 |
<dt>Capability Manager</dt>
|
7 |
<dd>
|
8 |
<ul>
|
9 |
+
<li><a href="http://agapetry.com" class="capsman" target="_blank"><?php _e('Plugin Homepage', 'capsman-enhanced'); ?></a></li>
|
10 |
+
<li><a href="http://presspermit.com" class="docs" target="_blank"><?php _e('Documentation', 'capsman-enhanced'); ?></a></li>
|
11 |
+
<li><a href="http://agapetry.net/forum" class="help" target="_blank"><?php _e('Support Forum', 'capsman-enhanced'); ?></a></li>
|
12 |
+
<li><a href="http://agapetry.com" class="home" target="_blank"><?php _e('Author Homepage', 'capsman-enhanced')?></a></li>
|
13 |
+
<li><a href="http://agapetry.com" class="donate" target="_blank"><?php _e('Help donating', 'capsman-enhanced')?></a></li>
|
14 |
</ul>
|
15 |
</dd>
|
16 |
</dl>
|
20 |
function agp_admin_footer( $mod_id = '' ) {
|
21 |
?>
|
22 |
<p class="footer">
|
23 |
+
<a href="http://wordpress.org/extend/plugins/capability-manager-enhanced"><?php printf( __( 'Capability Manager Enhanced %s', 'capsman-enhanced' ), CAPSMAN_ENH_VERSION );?></a>
|
24 |
+
| © <?php _e( 'Copyright 2010 Jordi Canals', 'capsman-enhanced' );?>
|
25 |
|
|
26 |
<?php
|
27 |
+
printf( __( 'Modifications © Copyright %1$s %2$s', 'capsman-enhanced' ), '2012-2015', '<a href="http://agapetry.com">Kevin Behrens</a>' );?>
|
28 |
</p>
|
29 |
<?php
|
30 |
}
|
includes/admin.php
CHANGED
@@ -47,7 +47,7 @@ if( defined('PP_ACTIVE') ) {
|
|
47 |
<div id="icon-capsman-admin" class="icon32"></div>
|
48 |
<?php endif; ?>
|
49 |
|
50 |
-
<h2 <?php echo $style;?>><?php _e('Roles and Capabilities',
|
51 |
|
52 |
<form method="post" action="admin.php?page=<?php echo $this->ID ?>">
|
53 |
<?php wp_nonce_field('capsman-general-manager'); ?>
|
@@ -56,10 +56,10 @@ if( defined('PP_ACTIVE') ) {
|
|
56 |
<tr>
|
57 |
<td class="content">
|
58 |
<dl>
|
59 |
-
<dt><?php printf(__('Capabilities for %s',
|
60 |
<dd>
|
61 |
<div>
|
62 |
-
<?php _e( 'View and modify capabilities WordPress associates with each role. Changes <strong>remain in the database</strong> even if you deactivate this plugin.',
|
63 |
</div>
|
64 |
|
65 |
<?php
|
@@ -68,10 +68,9 @@ if( defined('PP_ACTIVE') ) {
|
|
68 |
} else {
|
69 |
global $capsman;
|
70 |
$img_url = $capsman->mod_url . '/images/';
|
71 |
-
$lang_id = $this->ID;
|
72 |
|
73 |
echo '<div style="margin-top:5px">';
|
74 |
-
_e( "To further customize editing or viewing access, consider stepping up to <a href='#pp-more'>Press Permit</a>.",
|
75 |
echo '</div>';
|
76 |
?>
|
77 |
<script type="text/javascript">
|
@@ -102,63 +101,63 @@ if( defined('PP_ACTIVE') ) {
|
|
102 |
|
103 |
<br /><div id="pp_features"><div class="pp-logo"><a href="http://presspermit.com"><img src="<?php echo $img_url;?>pp-logo.png" /></a></div><div class="features-wrap"><ul class="pp-features">
|
104 |
<li>
|
105 |
-
<?php _e( "Automatically define type-specific capabilities for your custom post types and taxonomies",
|
106 |
<a href="http://presspermit.com/tutorial/regulate-post-type-access" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
107 |
|
108 |
<li>
|
109 |
-
<?php _e( "Assign standard WP roles supplementally for a specific post type",
|
110 |
<a href="http://presspermit.com/tutorial/regulate-post-type-access" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
111 |
|
112 |
<li>
|
113 |
-
<?php _e( "Assign custom WP roles supplementally for a specific post type <em>(Pro)</em>",
|
114 |
<a href="http://presspermit.com/tutorial/custom-role-usage" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
115 |
|
116 |
<li>
|
117 |
-
<?php _e( "Customize reading permissions per-category or per-post",
|
118 |
<a href="http://presspermit.com/tutorial/category-exceptions" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
119 |
|
120 |
<li>
|
121 |
-
<?php _e( "Customize editing permissions per-category or per-post <em>(Pro)</em>",
|
122 |
<a href="http://presspermit.com/tutorial/page-editing-exceptions" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
123 |
|
124 |
<li>
|
125 |
-
<?php _e( "Custom Post Visibility statuses, fully implemented throughout wp-admin <em>(Pro)</em>",
|
126 |
<a href="http://presspermit.com/tutorial/custom-post-visibility" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
127 |
|
128 |
<li>
|
129 |
-
<?php _e( "Custom Moderation statuses for access-controlled, multi-step publishing workflow <em>(Pro)</em>",
|
130 |
<a href="http://presspermit.com/tutorial/multi-step-moderation" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
131 |
|
132 |
<li>
|
133 |
-
<?php _e( "Regulate permissions for Edit Flow post statuses <em>(Pro)</em>",
|
134 |
<a href="http://presspermit.com/tutorial/edit-flow-integration" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
135 |
|
136 |
<li>
|
137 |
-
<?php _e( "Customize the moderated editing of published content with Revisionary or Post Forking <em>(Pro)</em>",
|
138 |
<a href="http://presspermit.com/tutorial/published-content-revision" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
139 |
|
140 |
<li>
|
141 |
-
<?php _e( "Grant Spectator, Participant or Moderator access to specific bbPress forums <em>(Pro)</em>",
|
142 |
<a href="http://presspermit.com/tutorial/bbpress-exceptions" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
143 |
|
144 |
<li>
|
145 |
-
<?php _e( "Grant supplemental content permissions to a BuddyPress group <em>(Pro)</em>",
|
146 |
<a href="http://presspermit.com/tutorial/buddypress-content-permissions" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
147 |
|
148 |
<li>
|
149 |
-
<?php _e( "WPML integration to mirror permissions to translations <em>(Pro)</em>",
|
150 |
</li>
|
151 |
|
152 |
<li>
|
153 |
-
<?php _e( "Member support forum",
|
154 |
</li>
|
155 |
|
156 |
</ul></div>
|
157 |
<?php
|
158 |
echo '<div>';
|
159 |
-
printf( __('%1$sgrab%2$s %3$s', 'capsman'), '<strong>', '</strong>', '<span class="plugins update-message"><a href="' . cme_plugin_info_url('press-permit-core') . '" class="thickbox" title="' . sprintf( __('%s (free install)', 'capsman'), 'Press Permit Core' ) . '">Press Permit Core</a></span>' );
|
160 |
echo ' • ';
|
161 |
-
printf( __('%1$sbuy%2$s %3$s', 'capsman'), '<strong>', '</strong>', '<a href="http://presspermit.com" target="_blank" title="' . sprintf( __('%s info/purchase', 'capsman'), 'Press Permit Pro' ) . '">Press Permit Pro</a>' );
|
162 |
echo ' • ';
|
163 |
echo '<a href="#pp-hide">hide</a>';
|
164 |
echo '</div></div>';
|
@@ -240,10 +239,10 @@ if( defined('PP_ACTIVE') ) {
|
|
240 |
|
241 |
//if ( count($stati) > 5 ) {
|
242 |
$cap_type_names = array(
|
243 |
-
'' => __( ' ',
|
244 |
-
'read' => __( 'Reading',
|
245 |
-
'edit' => __( 'Editing Capabilities',
|
246 |
-
'delete' => __( 'Deletion Capabilities',
|
247 |
);
|
248 |
|
249 |
//} else {
|
@@ -251,16 +250,16 @@ if( defined('PP_ACTIVE') ) {
|
|
251 |
//}
|
252 |
|
253 |
$cap_tips = array(
|
254 |
-
'read_private' => __( 'can read posts which are currently published with private visibility',
|
255 |
-
'edit' => __( 'has basic editing capability (but may need other capabilities based on post status and ownership)',
|
256 |
-
'edit_others' => __( 'can edit posts which were created by other users',
|
257 |
-
'edit_published' => __( 'can edit posts which are currently published',
|
258 |
-
'edit_private' => __( 'can edit posts which are currently published with private visibility',
|
259 |
-
'publish' => __( 'can make a post publicly visible',
|
260 |
-
'delete' => __( 'has basic deletion capability (but may need other capabilities based on post status and ownership)',
|
261 |
-
'delete_others' => __( 'can delete posts which were created by other users',
|
262 |
-
'delete_published' => __( 'can delete posts which are currently published',
|
263 |
-
'delete_private' => __( 'can delete posts which are currently published with private visibility',
|
264 |
);
|
265 |
|
266 |
$default_caps = array( 'read_private_posts', 'edit_posts', 'edit_others_posts', 'edit_published_posts', 'edit_private_posts', 'publish_posts', 'delete_posts', 'delete_others_posts', 'delete_published_posts', 'delete_private_posts',
|
@@ -359,7 +358,7 @@ if( defined('PP_ACTIVE') ) {
|
|
359 |
|
360 |
if ( $is_administrator || current_user_can($cap_name) ) {
|
361 |
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
|
362 |
-
$title_text = sprintf( __( '%s: assigned by Permission Group', 'capsman' ), $cap_name );
|
363 |
} else {
|
364 |
$title_text = $cap_name;
|
365 |
}
|
@@ -428,7 +427,7 @@ if( defined('PP_ACTIVE') ) {
|
|
428 |
|
429 |
ksort( $core_caps );
|
430 |
|
431 |
-
echo '<p> </p><h3>' . __( 'Other WordPress Core Capabilities',
|
432 |
echo '<table width="100%" class="form-table cme-checklist"><tr>';
|
433 |
|
434 |
|
@@ -451,7 +450,7 @@ if( defined('PP_ACTIVE') ) {
|
|
451 |
|
452 |
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
|
453 |
$class .= ' cap-metagroup';
|
454 |
-
$title_text = sprintf( __( '%s: assigned by Permission Group', 'capsman' ), $cap_name );
|
455 |
} else {
|
456 |
$title_text = $cap_name;
|
457 |
}
|
@@ -489,14 +488,14 @@ if( defined('PP_ACTIVE') ) {
|
|
489 |
<tr class="cme-bulk-select">
|
490 |
<td colspan="<?php echo $checks_per_row;?>">
|
491 |
<span style="float:right">
|
492 |
-
<input type="checkbox" class="cme-check-all" title="<?php _e('check/uncheck all', 'capsman');?>"> <a class="cme-neg-all" href="#" title="<?php _e('negate all (storing as disabled capabilities)', 'capsman');?>">X</a> <a class="cme-switch-all" href="#" title="<?php _e('negate none (add/remove all capabilities normally)', 'capsman');?>">X</a>
|
493 |
</span>
|
494 |
</td></tr>
|
495 |
|
496 |
</table>
|
497 |
|
498 |
<?php
|
499 |
-
echo '<p> </p><h3>' . __( 'Additional Capabilities',
|
500 |
|
501 |
?>
|
502 |
<table width='100%' class="form-table cme-checklist">
|
@@ -540,7 +539,7 @@ if( defined('PP_ACTIVE') ) {
|
|
540 |
|
541 |
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
|
542 |
$class .= ' cap-metagroup';
|
543 |
-
$title_text = sprintf( __( '%s: assigned by Permission Group', 'capsman' ), $cap_name );
|
544 |
} else {
|
545 |
$title_text = $cap_name;
|
546 |
}
|
@@ -596,7 +595,7 @@ if( defined('PP_ACTIVE') ) {
|
|
596 |
<?php
|
597 |
$level = ak_caps2level($rcaps);
|
598 |
?>
|
599 |
-
<?php _e('Level:',
|
600 |
<?php for ( $l = $this->max_level; $l >= 0; $l-- ) {?>
|
601 |
<option value="<?php echo $l; ?>" style="text-align:right;"<?php selected($level, $l); ?>> <?php echo $l; ?> </option>
|
602 |
<?php }
|
@@ -605,7 +604,7 @@ if( defined('PP_ACTIVE') ) {
|
|
605 |
</span>
|
606 |
|
607 |
<span style="float:right">
|
608 |
-
<input type="checkbox" class="cme-check-all" title="<?php _e('check/uncheck all', 'capsman');?>"> <a class="cme-neg-all" href="#" title="<?php _e('negate all (storing as disabled capabilities)', 'capsman');?>">X</a> <a class="cme-switch-all" href="#" title="<?php _e('negate none (add/remove all capabilities normally)', 'capsman');?>">X</a>
|
609 |
</span>
|
610 |
</td></tr>
|
611 |
|
@@ -614,7 +613,7 @@ if( defined('PP_ACTIVE') ) {
|
|
614 |
<br />
|
615 |
<?php if ( ! defined('PP_ACTIVE') || pp_get_option('display_hints') ) :?>
|
616 |
<div class="cme-subtext">
|
617 |
-
<?php _e( 'Note: Underscores replace spaces in stored capability name ("edit users" => "edit_users").', 'capsman' ); ?>
|
618 |
</div>
|
619 |
<?php endif;?>
|
620 |
</span>
|
@@ -630,10 +629,10 @@ if( defined('PP_ACTIVE') ) {
|
|
630 |
<p class="submit">
|
631 |
<input type="hidden" name="action" value="update" />
|
632 |
<input type="hidden" name="current" value="<?php echo $default; ?>" />
|
633 |
-
<input type="submit" name="SaveRole" value="<?php _e('Save Changes',
|
634 |
|
635 |
<?php if ( current_user_can('administrator') && 'administrator' != $default ) : ?>
|
636 |
-
<a class="ak-delete" title="<?php echo esc_attr(__('Delete this role',
|
637 |
<?php endif; ?>
|
638 |
</p>
|
639 |
|
@@ -646,7 +645,7 @@ if( defined('PP_ACTIVE') ) {
|
|
646 |
<?php agp_admin_authoring($this->ID); ?>
|
647 |
|
648 |
<dl>
|
649 |
-
<dt><?php if ( defined('WPLANG') && WPLANG ) _e('Select New Role',
|
650 |
<dd style="text-align:center;">
|
651 |
<p><select name="role">
|
652 |
<?php
|
@@ -654,47 +653,47 @@ if( defined('PP_ACTIVE') ) {
|
|
654 |
echo '<option value="' . $role .'"'; selected($default, $role); echo '> ' . $name . ' </option>';
|
655 |
}
|
656 |
?>
|
657 |
-
</select><span style="margin-left:20px"><input type="submit" name="LoadRole" value="<?php if ( defined('WPLANG') && WPLANG ) _e('Change',
|
658 |
</dd>
|
659 |
</dl>
|
660 |
|
661 |
<dl>
|
662 |
-
<dt><?php _e('Create New Role',
|
663 |
<dd style="text-align:center;">
|
664 |
<?php $class = ( $support_pp_only_roles ) ? 'tight-text' : 'regular-text'; ?>
|
665 |
-
<p><input type="text" name="create-name"" class="<?php echo $class;?>" placeholder="<?php _e('Name of new role',
|
666 |
|
667 |
<?php if( $support_pp_only_roles ) : ?>
|
668 |
-
<label for="new_role_pp_only" title="<?php _e('Make role available for supplemental assignment to Permission Groups only', 'capsman');?>"> <input type="checkbox" name="new_role_pp_only" id="new_role_pp_only" value="1"> <?php _e('hidden', 'capsman'); ?> </label>
|
669 |
<?php endif; ?>
|
670 |
|
671 |
<br />
|
672 |
-
<input type="submit" name="CreateRole" value="<?php _e('Create',
|
673 |
</p>
|
674 |
</dd>
|
675 |
</dl>
|
676 |
|
677 |
<dl>
|
678 |
-
<dt><?php defined('WPLANG') && WPLANG ? _e('Copy this role to',
|
679 |
<dd style="text-align:center;">
|
680 |
<?php $class = ( $support_pp_only_roles ) ? 'tight-text' : 'regular-text'; ?>
|
681 |
-
<p><input type="text" name="copy-name" class="<?php echo $class;?>" placeholder="<?php _e('Name of copied role',
|
682 |
|
683 |
<?php if( $support_pp_only_roles ) : ?>
|
684 |
-
<label for="copy_role_pp_only" title="<?php _e('Make role available for supplemental assignment to Permission Groups only', 'capsman');?>"> <input type="checkbox" name="copy_role_pp_only" id="copy_role_pp_only" value="1"> <?php _e('hidden', 'capsman'); ?> </label>
|
685 |
<?php endif; ?>
|
686 |
|
687 |
<br />
|
688 |
-
<input type="submit" name="CopyRole" value="<?php _e('Copy',
|
689 |
</p>
|
690 |
</dd>
|
691 |
</dl>
|
692 |
|
693 |
<dl>
|
694 |
-
<dt><?php _e('Add Capability',
|
695 |
<dd style="text-align:center;">
|
696 |
-
<p><input type="text" name="capability-name" class="regular-text" placeholder="<?php _e('capability name',
|
697 |
-
<input type="submit" name="AddCap" value="<?php _e('Add to role',
|
698 |
</dd>
|
699 |
</dl>
|
700 |
|
@@ -722,10 +721,10 @@ function cme_network_role_ui( $default ) {
|
|
722 |
$checked = ( in_array( $default, $autocreate_roles ) ) ? 'checked="checked"': '';
|
723 |
?>
|
724 |
<div style="margin-bottom: 5px">
|
725 |
-
<label for="cme_autocreate_role" title="<?php _e('Create this role definition in new (future) sites', 'capsman');?>"><input type="checkbox" name="cme_autocreate_role" id="cme_autocreate_role" value="1" <?php echo $checked;?>> <?php _e('include in new sites', 'capsman'); ?> </label>
|
726 |
</div>
|
727 |
<div>
|
728 |
-
<label for="cme_net_sync_role" title="<?php echo esc_attr(__('Copy / update this role definition to all sites now', 'capsman'));?>"><input type="checkbox" name="cme_net_sync_role" id="cme_net_sync_role" value="1"> <?php _e('sync role to all sites now', 'capsman'); ?> </label>
|
729 |
</div>
|
730 |
</div>
|
731 |
<?php
|
47 |
<div id="icon-capsman-admin" class="icon32"></div>
|
48 |
<?php endif; ?>
|
49 |
|
50 |
+
<h2 <?php echo $style;?>><?php _e('Roles and Capabilities', 'capsman-enhanced') ?></h2>
|
51 |
|
52 |
<form method="post" action="admin.php?page=<?php echo $this->ID ?>">
|
53 |
<?php wp_nonce_field('capsman-general-manager'); ?>
|
56 |
<tr>
|
57 |
<td class="content">
|
58 |
<dl>
|
59 |
+
<dt><?php printf(__('Capabilities for %s', 'capsman-enhanced'), $roles[$default]); ?></dt>
|
60 |
<dd>
|
61 |
<div>
|
62 |
+
<?php _e( 'View and modify capabilities WordPress associates with each role. Changes <strong>remain in the database</strong> even if you deactivate this plugin.', 'capsman-enhanced' ); ?>
|
63 |
</div>
|
64 |
|
65 |
<?php
|
68 |
} else {
|
69 |
global $capsman;
|
70 |
$img_url = $capsman->mod_url . '/images/';
|
|
|
71 |
|
72 |
echo '<div style="margin-top:5px">';
|
73 |
+
_e( "To further customize editing or viewing access, consider stepping up to <a href='#pp-more'>Press Permit</a>.", 'capsman-enhanced' );
|
74 |
echo '</div>';
|
75 |
?>
|
76 |
<script type="text/javascript">
|
101 |
|
102 |
<br /><div id="pp_features"><div class="pp-logo"><a href="http://presspermit.com"><img src="<?php echo $img_url;?>pp-logo.png" /></a></div><div class="features-wrap"><ul class="pp-features">
|
103 |
<li>
|
104 |
+
<?php _e( "Automatically define type-specific capabilities for your custom post types and taxonomies", 'capsman-enhanced' );?>
|
105 |
<a href="http://presspermit.com/tutorial/regulate-post-type-access" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
106 |
|
107 |
<li>
|
108 |
+
<?php _e( "Assign standard WP roles supplementally for a specific post type", 'capsman-enhanced' );?>
|
109 |
<a href="http://presspermit.com/tutorial/regulate-post-type-access" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
110 |
|
111 |
<li>
|
112 |
+
<?php _e( "Assign custom WP roles supplementally for a specific post type <em>(Pro)</em>", 'capsman-enhanced' );?>
|
113 |
<a href="http://presspermit.com/tutorial/custom-role-usage" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
114 |
|
115 |
<li>
|
116 |
+
<?php _e( "Customize reading permissions per-category or per-post", 'capsman-enhanced' );?>
|
117 |
<a href="http://presspermit.com/tutorial/category-exceptions" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
118 |
|
119 |
<li>
|
120 |
+
<?php _e( "Customize editing permissions per-category or per-post <em>(Pro)</em>", 'capsman-enhanced' );?>
|
121 |
<a href="http://presspermit.com/tutorial/page-editing-exceptions" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
122 |
|
123 |
<li>
|
124 |
+
<?php _e( "Custom Post Visibility statuses, fully implemented throughout wp-admin <em>(Pro)</em>", 'capsman-enhanced' );?>
|
125 |
<a href="http://presspermit.com/tutorial/custom-post-visibility" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
126 |
|
127 |
<li>
|
128 |
+
<?php _e( "Custom Moderation statuses for access-controlled, multi-step publishing workflow <em>(Pro)</em>", 'capsman-enhanced' );?>
|
129 |
<a href="http://presspermit.com/tutorial/multi-step-moderation" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
130 |
|
131 |
<li>
|
132 |
+
<?php _e( "Regulate permissions for Edit Flow post statuses <em>(Pro)</em>", 'capsman-enhanced' );?>
|
133 |
<a href="http://presspermit.com/tutorial/edit-flow-integration" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
134 |
|
135 |
<li>
|
136 |
+
<?php _e( "Customize the moderated editing of published content with Revisionary or Post Forking <em>(Pro)</em>", 'capsman-enhanced' );?>
|
137 |
<a href="http://presspermit.com/tutorial/published-content-revision" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
138 |
|
139 |
<li>
|
140 |
+
<?php _e( "Grant Spectator, Participant or Moderator access to specific bbPress forums <em>(Pro)</em>", 'capsman-enhanced' );?>
|
141 |
<a href="http://presspermit.com/tutorial/bbpress-exceptions" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
142 |
|
143 |
<li>
|
144 |
+
<?php _e( "Grant supplemental content permissions to a BuddyPress group <em>(Pro)</em>", 'capsman-enhanced' );?>
|
145 |
<a href="http://presspermit.com/tutorial/buddypress-content-permissions" target="_blank"><img class="cme-play" src="<?php echo $img_url;?>play.png" /></a></li>
|
146 |
|
147 |
<li>
|
148 |
+
<?php _e( "WPML integration to mirror permissions to translations <em>(Pro)</em>", 'capsman-enhanced' );?>
|
149 |
</li>
|
150 |
|
151 |
<li>
|
152 |
+
<?php _e( "Member support forum", 'capsman-enhanced' );?>
|
153 |
</li>
|
154 |
|
155 |
</ul></div>
|
156 |
<?php
|
157 |
echo '<div>';
|
158 |
+
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'), 'Press Permit Core' ) . '">Press Permit Core</a></span>' );
|
159 |
echo ' • ';
|
160 |
+
printf( __('%1$sbuy%2$s %3$s', 'capsman-enhanced'), '<strong>', '</strong>', '<a href="http://presspermit.com" target="_blank" title="' . sprintf( __('%s info/purchase', 'capsman-enhanced'), 'Press Permit Pro' ) . '">Press Permit Pro</a>' );
|
161 |
echo ' • ';
|
162 |
echo '<a href="#pp-hide">hide</a>';
|
163 |
echo '</div></div>';
|
239 |
|
240 |
//if ( count($stati) > 5 ) {
|
241 |
$cap_type_names = array(
|
242 |
+
'' => __( ' ', 'capsman-enhanced' ),
|
243 |
+
'read' => __( 'Reading', 'capsman-enhanced' ),
|
244 |
+
'edit' => __( 'Editing Capabilities', 'capsman-enhanced' ),
|
245 |
+
'delete' => __( 'Deletion Capabilities', 'capsman-enhanced' )
|
246 |
);
|
247 |
|
248 |
//} else {
|
250 |
//}
|
251 |
|
252 |
$cap_tips = array(
|
253 |
+
'read_private' => __( 'can read posts which are currently published with private visibility', 'capsman-enhanced' ),
|
254 |
+
'edit' => __( 'has basic editing capability (but may need other capabilities based on post status and ownership)', 'capsman-enhanced' ),
|
255 |
+
'edit_others' => __( 'can edit posts which were created by other users', 'capsman-enhanced' ),
|
256 |
+
'edit_published' => __( 'can edit posts which are currently published', 'capsman-enhanced' ),
|
257 |
+
'edit_private' => __( 'can edit posts which are currently published with private visibility', 'capsman-enhanced' ),
|
258 |
+
'publish' => __( 'can make a post publicly visible', 'capsman-enhanced' ),
|
259 |
+
'delete' => __( 'has basic deletion capability (but may need other capabilities based on post status and ownership)', 'capsman-enhanced' ),
|
260 |
+
'delete_others' => __( 'can delete posts which were created by other users', 'capsman-enhanced' ),
|
261 |
+
'delete_published' => __( 'can delete posts which are currently published', 'capsman-enhanced' ),
|
262 |
+
'delete_private' => __( 'can delete posts which are currently published with private visibility', 'capsman-enhanced' ),
|
263 |
);
|
264 |
|
265 |
$default_caps = array( 'read_private_posts', 'edit_posts', 'edit_others_posts', 'edit_published_posts', 'edit_private_posts', 'publish_posts', 'delete_posts', 'delete_others_posts', 'delete_published_posts', 'delete_private_posts',
|
358 |
|
359 |
if ( $is_administrator || current_user_can($cap_name) ) {
|
360 |
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
|
361 |
+
$title_text = sprintf( __( '%s: assigned by Permission Group', 'capsman-enhanced' ), $cap_name );
|
362 |
} else {
|
363 |
$title_text = $cap_name;
|
364 |
}
|
427 |
|
428 |
ksort( $core_caps );
|
429 |
|
430 |
+
echo '<p> </p><h3>' . __( 'Other WordPress Core Capabilities', 'capsman-enhanced' ) . '</h3>';
|
431 |
echo '<table width="100%" class="form-table cme-checklist"><tr>';
|
432 |
|
433 |
|
450 |
|
451 |
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
|
452 |
$class .= ' cap-metagroup';
|
453 |
+
$title_text = sprintf( __( '%s: assigned by Permission Group', 'capsman-enhanced' ), $cap_name );
|
454 |
} else {
|
455 |
$title_text = $cap_name;
|
456 |
}
|
488 |
<tr class="cme-bulk-select">
|
489 |
<td colspan="<?php echo $checks_per_row;?>">
|
490 |
<span style="float:right">
|
491 |
+
<input type="checkbox" class="cme-check-all" title="<?php _e('check/uncheck all', 'capsman-enhanced');?>"> <a class="cme-neg-all" href="#" title="<?php _e('negate all (storing as disabled capabilities)', 'capsman-enhanced');?>">X</a> <a class="cme-switch-all" href="#" title="<?php _e('negate none (add/remove all capabilities normally)', 'capsman-enhanced');?>">X</a>
|
492 |
</span>
|
493 |
</td></tr>
|
494 |
|
495 |
</table>
|
496 |
|
497 |
<?php
|
498 |
+
echo '<p> </p><h3>' . __( 'Additional Capabilities', 'capsman-enhanced' ) . '</h3>';
|
499 |
|
500 |
?>
|
501 |
<table width='100%' class="form-table cme-checklist">
|
539 |
|
540 |
if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
|
541 |
$class .= ' cap-metagroup';
|
542 |
+
$title_text = sprintf( __( '%s: assigned by Permission Group', 'capsman-enhanced' ), $cap_name );
|
543 |
} else {
|
544 |
$title_text = $cap_name;
|
545 |
}
|
595 |
<?php
|
596 |
$level = ak_caps2level($rcaps);
|
597 |
?>
|
598 |
+
<?php _e('Level:', 'capsman-enhanced') ;?><select name="level">
|
599 |
<?php for ( $l = $this->max_level; $l >= 0; $l-- ) {?>
|
600 |
<option value="<?php echo $l; ?>" style="text-align:right;"<?php selected($level, $l); ?>> <?php echo $l; ?> </option>
|
601 |
<?php }
|
604 |
</span>
|
605 |
|
606 |
<span style="float:right">
|
607 |
+
<input type="checkbox" class="cme-check-all" title="<?php _e('check/uncheck all', 'capsman-enhanced');?>"> <a class="cme-neg-all" href="#" title="<?php _e('negate all (storing as disabled capabilities)', 'capsman-enhanced');?>">X</a> <a class="cme-switch-all" href="#" title="<?php _e('negate none (add/remove all capabilities normally)', 'capsman-enhanced');?>">X</a>
|
608 |
</span>
|
609 |
</td></tr>
|
610 |
|
613 |
<br />
|
614 |
<?php if ( ! defined('PP_ACTIVE') || pp_get_option('display_hints') ) :?>
|
615 |
<div class="cme-subtext">
|
616 |
+
<?php _e( 'Note: Underscores replace spaces in stored capability name ("edit users" => "edit_users").', 'capsman-enhanced' ); ?>
|
617 |
</div>
|
618 |
<?php endif;?>
|
619 |
</span>
|
629 |
<p class="submit">
|
630 |
<input type="hidden" name="action" value="update" />
|
631 |
<input type="hidden" name="current" value="<?php echo $default; ?>" />
|
632 |
+
<input type="submit" name="SaveRole" value="<?php _e('Save Changes', 'capsman-enhanced') ?>" class="button-primary" />
|
633 |
|
634 |
<?php if ( current_user_can('administrator') && 'administrator' != $default ) : ?>
|
635 |
+
<a class="ak-delete" title="<?php echo esc_attr(__('Delete this role', 'capsman-enhanced')) ?>" href="<?php echo wp_nonce_url("admin.php?page={$this->ID}&action=delete&role={$default}", 'delete-role_' . $default); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf(__("You are about to delete the %s role.\n 'Cancel' to stop, 'OK' to delete.", 'capsman-enhanced'), $roles[$default])); ?>') ) { return true;}return false;"><?php _e('Delete Role', 'capsman-enhanced')?></a>
|
636 |
<?php endif; ?>
|
637 |
</p>
|
638 |
|
645 |
<?php agp_admin_authoring($this->ID); ?>
|
646 |
|
647 |
<dl>
|
648 |
+
<dt><?php if ( defined('WPLANG') && WPLANG ) _e('Select New Role', 'capsman-enhanced'); else echo('Select Role to View / Edit'); ?></dt>
|
649 |
<dd style="text-align:center;">
|
650 |
<p><select name="role">
|
651 |
<?php
|
653 |
echo '<option value="' . $role .'"'; selected($default, $role); echo '> ' . $name . ' </option>';
|
654 |
}
|
655 |
?>
|
656 |
+
</select><span style="margin-left:20px"><input type="submit" name="LoadRole" value="<?php if ( defined('WPLANG') && WPLANG ) _e('Change', 'capsman-enhanced'); else echo('Load'); ?>" class="button" /></span></p>
|
657 |
</dd>
|
658 |
</dl>
|
659 |
|
660 |
<dl>
|
661 |
+
<dt><?php _e('Create New Role', 'capsman-enhanced'); ?></dt>
|
662 |
<dd style="text-align:center;">
|
663 |
<?php $class = ( $support_pp_only_roles ) ? 'tight-text' : 'regular-text'; ?>
|
664 |
+
<p><input type="text" name="create-name"" class="<?php echo $class;?>" placeholder="<?php _e('Name of new role', 'capsman-enhanced') ?>" />
|
665 |
|
666 |
<?php if( $support_pp_only_roles ) : ?>
|
667 |
+
<label for="new_role_pp_only" title="<?php _e('Make role available for supplemental assignment to Permission Groups only', 'capsman-enhanced');?>"> <input type="checkbox" name="new_role_pp_only" id="new_role_pp_only" value="1"> <?php _e('hidden', 'capsman-enhanced'); ?> </label>
|
668 |
<?php endif; ?>
|
669 |
|
670 |
<br />
|
671 |
+
<input type="submit" name="CreateRole" value="<?php _e('Create', 'capsman-enhanced') ?>" class="button" />
|
672 |
</p>
|
673 |
</dd>
|
674 |
</dl>
|
675 |
|
676 |
<dl>
|
677 |
+
<dt><?php defined('WPLANG') && WPLANG ? _e('Copy this role to', 'capsman-enhanced') : printf( 'Copy %s Role', $roles[$default] ); ?></dt>
|
678 |
<dd style="text-align:center;">
|
679 |
<?php $class = ( $support_pp_only_roles ) ? 'tight-text' : 'regular-text'; ?>
|
680 |
+
<p><input type="text" name="copy-name" class="<?php echo $class;?>" placeholder="<?php _e('Name of copied role', 'capsman-enhanced') ?>" />
|
681 |
|
682 |
<?php if( $support_pp_only_roles ) : ?>
|
683 |
+
<label for="copy_role_pp_only" title="<?php _e('Make role available for supplemental assignment to Permission Groups only', 'capsman-enhanced');?>"> <input type="checkbox" name="copy_role_pp_only" id="copy_role_pp_only" value="1"> <?php _e('hidden', 'capsman-enhanced'); ?> </label>
|
684 |
<?php endif; ?>
|
685 |
|
686 |
<br />
|
687 |
+
<input type="submit" name="CopyRole" value="<?php _e('Copy', 'capsman-enhanced') ?>" class="button" />
|
688 |
</p>
|
689 |
</dd>
|
690 |
</dl>
|
691 |
|
692 |
<dl>
|
693 |
+
<dt><?php _e('Add Capability', 'capsman-enhanced'); ?></dt>
|
694 |
<dd style="text-align:center;">
|
695 |
+
<p><input type="text" name="capability-name" class="regular-text" placeholder="<?php _e('capability name', 'capsman-enhanced') ?>" /><br />
|
696 |
+
<input type="submit" name="AddCap" value="<?php _e('Add to role', 'capsman-enhanced') ?>" class="button" /></p>
|
697 |
</dd>
|
698 |
</dl>
|
699 |
|
721 |
$checked = ( in_array( $default, $autocreate_roles ) ) ? 'checked="checked"': '';
|
722 |
?>
|
723 |
<div style="margin-bottom: 5px">
|
724 |
+
<label for="cme_autocreate_role" title="<?php _e('Create this role definition in new (future) sites', 'capsman-enhanced');?>"><input type="checkbox" name="cme_autocreate_role" id="cme_autocreate_role" value="1" <?php echo $checked;?>> <?php _e('include in new sites', 'capsman-enhanced'); ?> </label>
|
725 |
</div>
|
726 |
<div>
|
727 |
+
<label for="cme_net_sync_role" title="<?php echo esc_attr(__('Copy / update this role definition to all sites now', 'capsman-enhanced'));?>"><input type="checkbox" name="cme_net_sync_role" id="cme_net_sync_role" value="1"> <?php _e('sync role to all sites now', 'capsman-enhanced'); ?> </label>
|
728 |
</div>
|
729 |
</div>
|
730 |
<?php
|
includes/backup-handler.php
CHANGED
@@ -6,7 +6,7 @@ class Capsman_BackupHandler
|
|
6 |
|
7 |
function __construct( $manager_obj ) {
|
8 |
if ( ! is_super_admin() && ! current_user_can( 'restore_roles' ) )
|
9 |
-
wp_die( __( 'You do not have permission to restore roles.', 'capsman' ) );
|
10 |
|
11 |
$this->cm = $manager_obj;
|
12 |
}
|
@@ -23,21 +23,21 @@ class Capsman_BackupHandler
|
|
23 |
|
24 |
global $wpdb;
|
25 |
$wp_roles = $wpdb->prefix . 'user_roles';
|
26 |
-
$cm_roles =
|
27 |
|
28 |
switch ( $_POST['action'] ) {
|
29 |
case 'backup':
|
30 |
$roles = get_option($wp_roles);
|
31 |
update_option($cm_roles, $roles);
|
32 |
-
ak_admin_notify(__('New backup saved.',
|
33 |
break;
|
34 |
case 'restore':
|
35 |
$roles = get_option($cm_roles);
|
36 |
if ( $roles ) {
|
37 |
update_option($wp_roles, $roles);
|
38 |
-
ak_admin_notify(__('Roles and Capabilities restored from last backup.',
|
39 |
} else {
|
40 |
-
ak_admin_error(__('Restore failed. No backup found.',
|
41 |
}
|
42 |
break;
|
43 |
}
|
@@ -56,7 +56,7 @@ class Capsman_BackupHandler
|
|
56 |
require_once(ABSPATH . 'wp-admin/includes/schema.php');
|
57 |
|
58 |
if ( ! function_exists('populate_roles') ) {
|
59 |
-
ak_admin_error(__('Needed function to create default roles not found!',
|
60 |
return;
|
61 |
}
|
62 |
|
@@ -69,7 +69,7 @@ class Capsman_BackupHandler
|
|
69 |
populate_roles();
|
70 |
$this->cm->setAdminCapability();
|
71 |
|
72 |
-
$msg = __('Roles and Capabilities reset to WordPress defaults',
|
73 |
|
74 |
if ( function_exists( 'pp_populate_roles' ) ) {
|
75 |
pp_populate_roles();
|
6 |
|
7 |
function __construct( $manager_obj ) {
|
8 |
if ( ! is_super_admin() && ! current_user_can( 'restore_roles' ) )
|
9 |
+
wp_die( __( 'You do not have permission to restore roles.', 'capsman-enhanced' ) );
|
10 |
|
11 |
$this->cm = $manager_obj;
|
12 |
}
|
23 |
|
24 |
global $wpdb;
|
25 |
$wp_roles = $wpdb->prefix . 'user_roles';
|
26 |
+
$cm_roles = 'capsman_backup';
|
27 |
|
28 |
switch ( $_POST['action'] ) {
|
29 |
case 'backup':
|
30 |
$roles = get_option($wp_roles);
|
31 |
update_option($cm_roles, $roles);
|
32 |
+
ak_admin_notify(__('New backup saved.', 'capsman-enhanced'));
|
33 |
break;
|
34 |
case 'restore':
|
35 |
$roles = get_option($cm_roles);
|
36 |
if ( $roles ) {
|
37 |
update_option($wp_roles, $roles);
|
38 |
+
ak_admin_notify(__('Roles and Capabilities restored from last backup.', 'capsman-enhanced'));
|
39 |
} else {
|
40 |
+
ak_admin_error(__('Restore failed. No backup found.', 'capsman-enhanced'));
|
41 |
}
|
42 |
break;
|
43 |
}
|
56 |
require_once(ABSPATH . 'wp-admin/includes/schema.php');
|
57 |
|
58 |
if ( ! function_exists('populate_roles') ) {
|
59 |
+
ak_admin_error(__('Needed function to create default roles not found!', 'capsman-enhanced'));
|
60 |
return;
|
61 |
}
|
62 |
|
69 |
populate_roles();
|
70 |
$this->cm->setAdminCapability();
|
71 |
|
72 |
+
$msg = __('Roles and Capabilities reset to WordPress defaults', 'capsman-enhanced');
|
73 |
|
74 |
if ( function_exists( 'pp_populate_roles' ) ) {
|
75 |
pp_populate_roles();
|
includes/backup.php
CHANGED
@@ -30,7 +30,7 @@
|
|
30 |
?>
|
31 |
<div class="wrap">
|
32 |
<div id="icon-capsman-admin" class="icon32"></div>
|
33 |
-
<h2><?php _e('Backup Tool for Capability Manager',
|
34 |
|
35 |
<form method="post" action="tools.php?page=<?php echo $this->ID ?>-tool">
|
36 |
<?php wp_nonce_field('capsman-backup-tool'); ?>
|
@@ -39,17 +39,17 @@
|
|
39 |
<tr>
|
40 |
<td class="content">
|
41 |
<dl>
|
42 |
-
<dt><?php _e('Backup and Restore',
|
43 |
<dd>
|
44 |
<table width='100%' class="form-table">
|
45 |
<tr>
|
46 |
-
<th scope="row"><?php _e('Select action:',
|
47 |
<td>
|
48 |
<select name="action">
|
49 |
-
<option value="backup"> <?php _e('Backup roles and capabilities',
|
50 |
-
<option value="restore"> <?php _e('Restore last saved backup',
|
51 |
</select>
|
52 |
-
<input type="submit" name="Perform" value="<?php _e('Do Action',
|
53 |
</td>
|
54 |
</tr>
|
55 |
</table>
|
@@ -57,14 +57,14 @@
|
|
57 |
</dl>
|
58 |
|
59 |
<dl>
|
60 |
-
<dt><?php if ( defined('WPLANG') && WPLANG && ( 'en_EN' != WPLANG ) ) _e('Reset WordPress Defaults',
|
61 |
<dd>
|
62 |
-
<p style="text-align:center;"><strong><span style="color:red;"><?php _e('WARNING:',
|
63 |
<br />
|
64 |
<?php
|
65 |
-
_e('If you have installed any plugin that adds new roles or capabilities, these will be lost.',
|
66 |
<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>
|
67 |
-
<p style="text-align:center;"><a class="ak-delete" title="<?php echo esc_attr(__('Reset Roles and Capabilities to WordPress defaults',
|
68 |
|
69 |
</dd>
|
70 |
</dl>
|
30 |
?>
|
31 |
<div class="wrap">
|
32 |
<div id="icon-capsman-admin" class="icon32"></div>
|
33 |
+
<h2><?php _e('Backup Tool for Capability Manager', 'capsman-enhanced') ?></h2>
|
34 |
|
35 |
<form method="post" action="tools.php?page=<?php echo $this->ID ?>-tool">
|
36 |
<?php wp_nonce_field('capsman-backup-tool'); ?>
|
39 |
<tr>
|
40 |
<td class="content">
|
41 |
<dl>
|
42 |
+
<dt><?php _e('Backup and Restore', 'capsman-enhanced'); ?></dt>
|
43 |
<dd>
|
44 |
<table width='100%' class="form-table">
|
45 |
<tr>
|
46 |
+
<th scope="row"><?php _e('Select action:', 'capsman-enhanced'); ?></th>
|
47 |
<td>
|
48 |
<select name="action">
|
49 |
+
<option value="backup"> <?php _e('Backup roles and capabilities', 'capsman-enhanced'); ?> </option>
|
50 |
+
<option value="restore"> <?php _e('Restore last saved backup', 'capsman-enhanced'); ?> </option>
|
51 |
</select>
|
52 |
+
<input type="submit" name="Perform" value="<?php _e('Do Action', 'capsman-enhanced') ?>" class="button-primary" />
|
53 |
</td>
|
54 |
</tr>
|
55 |
</table>
|
57 |
</dl>
|
58 |
|
59 |
<dl>
|
60 |
+
<dt><?php if ( defined('WPLANG') && WPLANG && ( 'en_EN' != WPLANG ) ) _e('Reset WordPress Defaults', 'capsman-enhanced'); else echo 'Reset Roles to WordPress Defaults';?></dt>
|
61 |
<dd>
|
62 |
+
<p style="text-align:center;"><strong><span style="color:red;"><?php _e('WARNING:', 'capsman-enhanced'); ?></span> <?php if ( defined('WPLANG') && WPLANG && ( 'en_EN' != WPLANG ) ) _e('Reseting default Roles and Capabilities will set them to the WordPress install defaults.', 'capsman-enhanced'); else echo 'This will delete and/or modify stored role definitions.'; ?></strong><br />
|
63 |
<br />
|
64 |
<?php
|
65 |
+
_e('If you have installed any plugin that adds new roles or capabilities, these will be lost.', 'capsman-enhanced')?><br />
|
66 |
<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>
|
67 |
+
<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&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>
|
68 |
|
69 |
</dd>
|
70 |
</dl>
|
includes/handler.php
CHANGED
@@ -13,26 +13,26 @@ class CapsmanHandler
|
|
13 |
// Create a new role.
|
14 |
if ( ! empty($post['CreateRole']) ) {
|
15 |
if ( $newrole = $this->createRole($post['create-name']) ) {
|
16 |
-
ak_admin_notify(__('New role created.',
|
17 |
$this->cm->current = $newrole;
|
18 |
} else {
|
19 |
if ( empty($post['create-name']) && ( ! defined('WPLANG') || ! WPLANG ) )
|
20 |
-
ak_admin_error( 'Error: No role name specified.',
|
21 |
else
|
22 |
-
ak_admin_error(__('Error: Failed creating the new role.',
|
23 |
}
|
24 |
|
25 |
// Copy current role to a new one.
|
26 |
} elseif ( ! empty($post['CopyRole']) ) {
|
27 |
$current = get_role($post['current']);
|
28 |
if ( $newrole = $this->createRole($post['copy-name'], $current->capabilities) ) {
|
29 |
-
ak_admin_notify(__('New role created.',
|
30 |
$this->cm->current = $newrole;
|
31 |
} else {
|
32 |
if ( empty($post['copy-name']) && ( ! defined('WPLANG') || ! WPLANG ) )
|
33 |
-
ak_admin_error( 'Error: No role name specified.',
|
34 |
else
|
35 |
-
ak_admin_error(__('Error: Failed creating the new role.',
|
36 |
}
|
37 |
|
38 |
// Save role changes. Already saved at start with self::saveRoleCapabilities().
|
@@ -90,13 +90,13 @@ class CapsmanHandler
|
|
90 |
|
91 |
} elseif ( ! empty($post['update_filtered_types']) ) {
|
92 |
if ( cme_update_pp_usage() ) {
|
93 |
-
ak_admin_notify(__('Capability settings saved.',
|
94 |
} else {
|
95 |
-
ak_admin_error(__('Error saving capability settings.',
|
96 |
}
|
97 |
} else {
|
98 |
// TODO: Implement exceptions. This must be a fatal error.
|
99 |
-
ak_admin_error(__('Bad form received.',
|
100 |
}
|
101 |
|
102 |
if ( ! empty($newrole) && defined('PP_ACTIVE') ) {
|
@@ -208,7 +208,7 @@ class CapsmanHandler
|
|
208 |
|
209 |
if ( 'administrator' == $role_name && isset($del_caps['manage_capabilities']) ) {
|
210 |
unset($del_caps['manage_capabilities']);
|
211 |
-
ak_admin_error(__('You cannot remove Manage Capabilities from Administrators',
|
212 |
}
|
213 |
// Add new capabilities to role
|
214 |
foreach ( $add_caps as $cap => $grant ) {
|
@@ -310,7 +310,7 @@ class CapsmanHandler
|
|
310 |
$this->cm->current = $_GET['role'];
|
311 |
$default = get_option('default_role');
|
312 |
if ( $default == $this->cm->current ) {
|
313 |
-
ak_admin_error(sprintf(__('Cannot delete default role. You <a href="%s">have to change it first</a>.',
|
314 |
return;
|
315 |
}
|
316 |
|
@@ -355,7 +355,7 @@ class CapsmanHandler
|
|
355 |
}
|
356 |
}
|
357 |
|
358 |
-
ak_admin_notify(sprintf(__('Role has been deleted. %1$d users moved to default role %2$s.',
|
359 |
$this->cm->current = $default;
|
360 |
}
|
361 |
}
|
13 |
// Create a new role.
|
14 |
if ( ! empty($post['CreateRole']) ) {
|
15 |
if ( $newrole = $this->createRole($post['create-name']) ) {
|
16 |
+
ak_admin_notify(__('New role created.', 'capsman-enhanced'));
|
17 |
$this->cm->current = $newrole;
|
18 |
} else {
|
19 |
if ( empty($post['create-name']) && ( ! defined('WPLANG') || ! WPLANG ) )
|
20 |
+
ak_admin_error( 'Error: No role name specified.', 'capsman-enhanced' );
|
21 |
else
|
22 |
+
ak_admin_error(__('Error: Failed creating the new role.', 'capsman-enhanced'));
|
23 |
}
|
24 |
|
25 |
// Copy current role to a new one.
|
26 |
} elseif ( ! empty($post['CopyRole']) ) {
|
27 |
$current = get_role($post['current']);
|
28 |
if ( $newrole = $this->createRole($post['copy-name'], $current->capabilities) ) {
|
29 |
+
ak_admin_notify(__('New role created.', 'capsman-enhanced'));
|
30 |
$this->cm->current = $newrole;
|
31 |
} else {
|
32 |
if ( empty($post['copy-name']) && ( ! defined('WPLANG') || ! WPLANG ) )
|
33 |
+
ak_admin_error( 'Error: No role name specified.', 'capsman-enhanced' );
|
34 |
else
|
35 |
+
ak_admin_error(__('Error: Failed creating the new role.', 'capsman-enhanced'));
|
36 |
}
|
37 |
|
38 |
// Save role changes. Already saved at start with self::saveRoleCapabilities().
|
90 |
|
91 |
} elseif ( ! empty($post['update_filtered_types']) ) {
|
92 |
if ( cme_update_pp_usage() ) {
|
93 |
+
ak_admin_notify(__('Capability settings saved.', 'capsman-enhanced'));
|
94 |
} else {
|
95 |
+
ak_admin_error(__('Error saving capability settings.', 'capsman-enhanced'));
|
96 |
}
|
97 |
} else {
|
98 |
// TODO: Implement exceptions. This must be a fatal error.
|
99 |
+
ak_admin_error(__('Bad form received.', 'capsman-enhanced'));
|
100 |
}
|
101 |
|
102 |
if ( ! empty($newrole) && defined('PP_ACTIVE') ) {
|
208 |
|
209 |
if ( 'administrator' == $role_name && isset($del_caps['manage_capabilities']) ) {
|
210 |
unset($del_caps['manage_capabilities']);
|
211 |
+
ak_admin_error(__('You cannot remove Manage Capabilities from Administrators', 'capsman-enhanced'));
|
212 |
}
|
213 |
// Add new capabilities to role
|
214 |
foreach ( $add_caps as $cap => $grant ) {
|
310 |
$this->cm->current = $_GET['role'];
|
311 |
$default = get_option('default_role');
|
312 |
if ( $default == $this->cm->current ) {
|
313 |
+
ak_admin_error(sprintf(__('Cannot delete default role. You <a href="%s">have to change it first</a>.', 'capsman-enhanced'), 'options-general.php'));
|
314 |
return;
|
315 |
}
|
316 |
|
355 |
}
|
356 |
}
|
357 |
|
358 |
+
ak_admin_notify(sprintf(__('Role has been deleted. %1$d users moved to default role %2$s.', 'capsman-enhanced'), $count, $this->cm->roles[$default]));
|
359 |
$this->cm->current = $default;
|
360 |
}
|
361 |
}
|
includes/manager.php
CHANGED
@@ -171,20 +171,20 @@ class CapabilityManager extends akPluginAbstract
|
|
171 |
$this->setAdminCapability();
|
172 |
}
|
173 |
|
174 |
-
|
175 |
-
add_action( 'pp_permissions_menu', array( &$this, 'pp_menu' ) );
|
176 |
-
} else {
|
177 |
-
add_users_page( __('Capability Manager', $this->ID), __('Capabilities', $this->ID), 'manage_capabilities', $this->ID, array($this, 'generalManager'));
|
178 |
-
}
|
179 |
|
180 |
$cap_name = ( is_super_admin() ) ? 'manage_capabilities' : 'restore_roles';
|
181 |
-
add_management_page(__('Capability Manager',
|
182 |
}
|
183 |
|
184 |
-
public function
|
185 |
-
|
186 |
-
|
187 |
-
|
|
|
|
|
|
|
|
|
188 |
}
|
189 |
|
190 |
/**
|
@@ -239,16 +239,32 @@ class CapabilityManager extends akPluginAbstract
|
|
239 |
if ( ! in_array( $cap, array( 'edit_user', 'delete_user', 'promote_user', 'remove_user' ) ) || ( ! isset($args[0]) ) || $user_id == (int) $args[0] ) {
|
240 |
return $caps;
|
241 |
}
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
252 |
}
|
253 |
|
254 |
return $caps;
|
@@ -260,7 +276,7 @@ class CapabilityManager extends akPluginAbstract
|
|
260 |
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && ( ! empty($_REQUEST['SaveRole']) || ! empty($_REQUEST['AddCap']) ) ) {
|
261 |
if ( ! current_user_can('manage_capabilities') && ! current_user_can('administrator') ) {
|
262 |
// TODO: Implement exceptions.
|
263 |
-
wp_die('<strong>' .__('What do you think you\'re doing?!?',
|
264 |
}
|
265 |
|
266 |
//$this->current = get_option('default_role'); // By default we manage the default role.
|
@@ -279,7 +295,7 @@ class CapabilityManager extends akPluginAbstract
|
|
279 |
function generalManager () {
|
280 |
if ( ! current_user_can('manage_capabilities') && ! current_user_can('administrator') ) {
|
281 |
// TODO: Implement exceptions.
|
282 |
-
wp_die('<strong>' .__('What do you think you\'re doing?!?',
|
283 |
}
|
284 |
|
285 |
if ( 'POST' == $_SERVER['REQUEST_METHOD'] ) {
|
@@ -287,9 +303,9 @@ class CapabilityManager extends akPluginAbstract
|
|
287 |
check_admin_referer('capsman-general-manager');
|
288 |
$this->processAdminGeneral();
|
289 |
} elseif ( ! empty($_REQUEST['SaveRole']) ) {
|
290 |
-
ak_admin_notify( $this->message
|
291 |
} elseif ( ! empty($_REQUEST['AddCap']) ) {
|
292 |
-
ak_admin_notify( $this->message
|
293 |
}
|
294 |
}
|
295 |
|
@@ -318,7 +334,7 @@ class CapabilityManager extends akPluginAbstract
|
|
318 |
{
|
319 |
if (! isset($_POST['action']) || 'update' != $_POST['action'] ) {
|
320 |
// TODO: Implement exceptions. This must be a fatal error.
|
321 |
-
ak_admin_error(__('Bad form Received',
|
322 |
return;
|
323 |
}
|
324 |
|
@@ -406,10 +422,13 @@ class CapabilityManager extends akPluginAbstract
|
|
406 |
$roles = ak_get_roles(true);
|
407 |
unset($roles['administrator']);
|
408 |
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
|
|
|
|
|
|
413 |
asort($this->capabilities);
|
414 |
|
415 |
foreach ( array_keys($roles) as $role ) {
|
@@ -435,7 +454,7 @@ class CapabilityManager extends akPluginAbstract
|
|
435 |
{
|
436 |
if ( ! current_user_can('restore_roles') && ! is_super_admin() ) {
|
437 |
// TODO: Implement exceptions.
|
438 |
-
wp_die('<strong>' .__('What do you think you\'re doing?!?',
|
439 |
}
|
440 |
|
441 |
if ( 'POST' == $_SERVER['REQUEST_METHOD'] ) {
|
171 |
$this->setAdminCapability();
|
172 |
}
|
173 |
|
174 |
+
add_action( 'admin_menu', array( &$this, 'cme_menu' ), 20 );
|
|
|
|
|
|
|
|
|
175 |
|
176 |
$cap_name = ( is_super_admin() ) ? 'manage_capabilities' : 'restore_roles';
|
177 |
+
add_management_page(__('Capability Manager', 'capsman-enhanced'), __('Capability Manager', 'capsman-enhanced'), $cap_name, $this->ID . '-tool', array($this, 'backupTool'));
|
178 |
}
|
179 |
|
180 |
+
public function cme_menu() {
|
181 |
+
if ( did_action( 'pp_admin_menu' ) ) { // Put Capabilities link on Permissions menu if Press Permit is active and user has access to it
|
182 |
+
global $pp_admin;
|
183 |
+
$menu_caption = ( defined('WPLANG') && WPLANG ) ? __('Capabilities', 'capsman-enhanced') : 'Role Capabilities';
|
184 |
+
add_submenu_page( $pp_admin->get_menu('options'), __('Capability Manager', 'capsman-enhanced'), $menu_caption, 'manage_capabilities', $this->ID, array($this, 'generalManager') );
|
185 |
+
} else {
|
186 |
+
add_users_page( __('Capability Manager', 'capsman-enhanced'), __('Capabilities', 'capsman-enhanced'), 'manage_capabilities', $this->ID, array($this, 'generalManager'));
|
187 |
+
}
|
188 |
}
|
189 |
|
190 |
/**
|
239 |
if ( ! in_array( $cap, array( 'edit_user', 'delete_user', 'promote_user', 'remove_user' ) ) || ( ! isset($args[0]) ) || $user_id == (int) $args[0] ) {
|
240 |
return $caps;
|
241 |
}
|
242 |
+
|
243 |
+
$user = new WP_User( (int) $args[0] );
|
244 |
+
|
245 |
+
if ( defined( 'CME_LEGACY_USER_EDIT_FILTER' ) && CME_LEGACY_USER_EDIT_FILTER ) {
|
246 |
+
$this->generateNames();
|
247 |
+
$valid = array_keys($this->roles);
|
248 |
+
|
249 |
+
foreach ( $user->roles as $role ) {
|
250 |
+
if ( ! in_array($role, $valid) ) {
|
251 |
+
$caps = array('do_not_allow');
|
252 |
+
break;
|
253 |
+
}
|
254 |
+
}
|
255 |
+
} else {
|
256 |
+
global $wp_roles;
|
257 |
+
|
258 |
+
foreach ( $user->roles as $role ) {
|
259 |
+
$r = get_role( $role );
|
260 |
+
$level = ak_caps2level($r->capabilities);
|
261 |
+
|
262 |
+
if ( $level > $this->max_level ) {
|
263 |
+
$caps = array('do_not_allow');
|
264 |
+
break;
|
265 |
+
}
|
266 |
+
}
|
267 |
+
|
268 |
}
|
269 |
|
270 |
return $caps;
|
276 |
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && ( ! empty($_REQUEST['SaveRole']) || ! empty($_REQUEST['AddCap']) ) ) {
|
277 |
if ( ! current_user_can('manage_capabilities') && ! current_user_can('administrator') ) {
|
278 |
// TODO: Implement exceptions.
|
279 |
+
wp_die('<strong>' .__('What do you think you\'re doing?!?', 'capsman-enhanced') . '</strong>');
|
280 |
}
|
281 |
|
282 |
//$this->current = get_option('default_role'); // By default we manage the default role.
|
295 |
function generalManager () {
|
296 |
if ( ! current_user_can('manage_capabilities') && ! current_user_can('administrator') ) {
|
297 |
// TODO: Implement exceptions.
|
298 |
+
wp_die('<strong>' .__('What do you think you\'re doing?!?', 'capsman-enhanced') . '</strong>');
|
299 |
}
|
300 |
|
301 |
if ( 'POST' == $_SERVER['REQUEST_METHOD'] ) {
|
303 |
check_admin_referer('capsman-general-manager');
|
304 |
$this->processAdminGeneral();
|
305 |
} elseif ( ! empty($_REQUEST['SaveRole']) ) {
|
306 |
+
ak_admin_notify( $this->message ); // moved update operation to earlier action to avoid UI refresh issues. But outputting notification there breaks styling.
|
307 |
} elseif ( ! empty($_REQUEST['AddCap']) ) {
|
308 |
+
ak_admin_notify( $this->message );
|
309 |
}
|
310 |
}
|
311 |
|
334 |
{
|
335 |
if (! isset($_POST['action']) || 'update' != $_POST['action'] ) {
|
336 |
// TODO: Implement exceptions. This must be a fatal error.
|
337 |
+
ak_admin_error(__('Bad form Received', 'capsman-enhanced'));
|
338 |
return;
|
339 |
}
|
340 |
|
422 |
$roles = ak_get_roles(true);
|
423 |
unset($roles['administrator']);
|
424 |
|
425 |
+
if ( ( defined( 'CME_LEGACY_USER_EDIT_FILTER' ) && CME_LEGACY_USER_EDIT_FILTER ) || ( ! empty( $_REQUEST['page'] ) && 'capsman' == $_REQUEST['page'] ) ) {
|
426 |
+
foreach ( $user->roles as $role ) { // Unset the roles from capability list.
|
427 |
+
unset ( $this->capabilities[$role] );
|
428 |
+
unset ( $roles[$role]); // User cannot manage his roles.
|
429 |
+
}
|
430 |
+
}
|
431 |
+
|
432 |
asort($this->capabilities);
|
433 |
|
434 |
foreach ( array_keys($roles) as $role ) {
|
454 |
{
|
455 |
if ( ! current_user_can('restore_roles') && ! is_super_admin() ) {
|
456 |
// TODO: Implement exceptions.
|
457 |
+
wp_die('<strong>' .__('What do you think you\'re doing?!?', 'capsman-enhanced') . '</strong>');
|
458 |
}
|
459 |
|
460 |
if ( 'POST' == $_SERVER['REQUEST_METHOD'] ) {
|
includes/pp-ui.php
CHANGED
@@ -41,9 +41,9 @@ class Capsman_PP_UI {
|
|
41 |
echo '<li>';
|
42 |
if ( defined( 'PPCE_VERSION' ) || ! defined( 'PPC_VERSION' ) ) {
|
43 |
if ( pp_get_option( 'advanced_options' ) )
|
44 |
-
$parenthetical = ' (' . sprintf( __( 'see %1$sRole Usage%2$s: "Pattern Roles"', 'capsman' ), "<a href='" . admin_url('admin.php?page=pp-role-usage') . "'>", '</a>' ) . ')';
|
45 |
else
|
46 |
-
$parenthetical = ' (' . sprintf( __( 'activate %1$sAdvanced settings%2$s, see Role Usage', 'capsman' ), "<a href='" . admin_url('admin.php?page=pp-settings&pp_tab=advanced') . "'>", '</a>' ). ')';
|
47 |
} else
|
48 |
$parenthetical = '';
|
49 |
|
@@ -83,7 +83,7 @@ class Capsman_PP_UI {
|
|
83 |
$pp_only = (array) pp_get_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');?>"><input type="checkbox" name="pp_only_role" id="pp_only_role" value="1" <?php echo $checked;?>> <?php _e('hidden role', 'capsman'); ?> </label>
|
87 |
</div>
|
88 |
<?php endif; ?>
|
89 |
<?php
|
@@ -93,15 +93,15 @@ class Capsman_PP_UI {
|
|
93 |
function pp_types_ui( $defined ) {
|
94 |
if ( current_user_can( 'pp_manage_settings' ) ) :?>
|
95 |
<dl>
|
96 |
-
<dt><?php _e('Force Type-Specific Capabilities', 'capsman'); ?></dt>
|
97 |
<dd style="text-align:center;">
|
98 |
<?php
|
99 |
-
$caption = __( 'Force unique capability names for:', 'capsman' );
|
100 |
echo "<p>$caption</p>";
|
101 |
|
102 |
if ( pp_get_option( 'display_hints' ) ) :?>
|
103 |
<div class="cme-subtext" style="margin-top:0">
|
104 |
-
<?php _e( '(PP Filtered Post Types, Taxonomies)', 'capsman' );?>
|
105 |
</div>
|
106 |
<?php endif;
|
107 |
|
@@ -161,7 +161,7 @@ class Capsman_PP_UI {
|
|
161 |
</div>
|
162 |
<?php endif; ?>
|
163 |
|
164 |
-
<input type="submit" name="update_filtered_types" value="<?php _e('Update', 'capsman') ?>" class="button" />
|
165 |
</dd>
|
166 |
</dl>
|
167 |
<?php endif;
|
41 |
echo '<li>';
|
42 |
if ( defined( 'PPCE_VERSION' ) || ! defined( 'PPC_VERSION' ) ) {
|
43 |
if ( pp_get_option( 'advanced_options' ) )
|
44 |
+
$parenthetical = ' (' . sprintf( __( 'see %1$sRole Usage%2$s: "Pattern Roles"', 'capsman-enhanced' ), "<a href='" . admin_url('admin.php?page=pp-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-settings&pp_tab=advanced') . "'>", '</a>' ). ')';
|
47 |
} else
|
48 |
$parenthetical = '';
|
49 |
|
83 |
$pp_only = (array) pp_get_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>
|
87 |
</div>
|
88 |
<?php endif; ?>
|
89 |
<?php
|
93 |
function pp_types_ui( $defined ) {
|
94 |
if ( current_user_can( 'pp_manage_settings' ) ) :?>
|
95 |
<dl>
|
96 |
+
<dt><?php _e('Force Type-Specific Capabilities', 'capsman-enhanced'); ?></dt>
|
97 |
<dd style="text-align:center;">
|
98 |
<?php
|
99 |
+
$caption = __( 'Force unique capability names for:', 'capsman-enhanced' );
|
100 |
echo "<p>$caption</p>";
|
101 |
|
102 |
if ( pp_get_option( 'display_hints' ) ) :?>
|
103 |
<div class="cme-subtext" style="margin-top:0">
|
104 |
+
<?php _e( '(PP Filtered Post Types, Taxonomies)', 'capsman-enhanced' );?>
|
105 |
</div>
|
106 |
<?php endif;
|
107 |
|
161 |
</div>
|
162 |
<?php endif; ?>
|
163 |
|
164 |
+
<input type="submit" name="update_filtered_types" value="<?php _e('Update', 'capsman-enhanced') ?>" class="button" />
|
165 |
</dd>
|
166 |
</dl>
|
167 |
<?php endif;
|
lang/capsman.pot
CHANGED
@@ -5,7 +5,7 @@ msgstr ""
|
|
5 |
"Project-Id-Version: Capability Manager Enhanced 1.5.3\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/capability-manager-"
|
7 |
"enhanced\n"
|
8 |
-
"POT-Creation-Date: 2015-04
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
5 |
"Project-Id-Version: Capability Manager Enhanced 1.5.3\n"
|
6 |
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/capability-manager-"
|
7 |
"enhanced\n"
|
8 |
+
"POT-Creation-Date: 2015-06-04 10:53:10+00:00\n"
|
9 |
"MIME-Version: 1.0\n"
|
10 |
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
"Content-Transfer-Encoding: 8bit\n"
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: txanny, kevinB
|
|
3 |
Donate Link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=JWZVFUDLLYQBA
|
4 |
Tags: roles, capabilities, manager, editor, rights, role, capability, types, taxonomies, network, multisite, default
|
5 |
Requires at least: 3.1
|
6 |
-
Tested up to: 4.3
|
7 |
-
Stable tag: 1.5.
|
8 |
|
9 |
A simple way to manage WordPress roles and capabilities.
|
10 |
|
@@ -105,6 +105,12 @@ You should have received a copy of the GNU General Public License along with thi
|
|
105 |
|
106 |
== Changelog ==
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
= 1.5.3 =
|
109 |
* Fixed : On single-site installations, non-Administrators with delete_users capability could give new users an Administrator role (since 1.5.2)
|
110 |
* Fixed : Deletion of a third party plugin role could cause users to be demoted to Subscriber inappropriately
|
3 |
Donate Link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=JWZVFUDLLYQBA
|
4 |
Tags: roles, capabilities, manager, editor, rights, role, capability, types, taxonomies, network, multisite, default
|
5 |
Requires at least: 3.1
|
6 |
+
Tested up to: 4.3.1
|
7 |
+
Stable tag: 1.5.4
|
8 |
|
9 |
A simple way to manage WordPress roles and capabilities.
|
10 |
|
105 |
|
106 |
== Changelog ==
|
107 |
|
108 |
+
= 1.5.4 =
|
109 |
+
* Fixed : Non-administrators' user editing capabilities were blocked if Press Permit Core was also active
|
110 |
+
* Fixed : Non-administrators could not edit other users with their role (define constant CME_LEGACY_USER_EDIT_FILTER to retain previous behavior)
|
111 |
+
* Fixed : Non-administrators could not assign their role to other users (define constant CME_LEGACY_USER_EDIT_FILTER to retain previous behavior)
|
112 |
+
* Lang : Changed text domain for language pack conformance
|
113 |
+
|
114 |
= 1.5.3 =
|
115 |
* Fixed : On single-site installations, non-Administrators with delete_users capability could give new users an Administrator role (since 1.5.2)
|
116 |
* Fixed : Deletion of a third party plugin role could cause users to be demoted to Subscriber inappropriately
|