PluginProbe ʕ •ᴥ•ʔ
PublishPress Capabilities – User Role Editor, Access Permissions, User Capabilities, Admin Menus / 1.4.2
PublishPress Capabilities – User Role Editor, Access Permissions, User Capabilities, Admin Menus v1.4.2
2.45.0 2.44.0 trunk 1.10 1.10.1 1.4.1 1.4.10 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5 1.5.1 1.5.10 1.5.11 1.5.2 1.5.3 1.5.4 1.5.5 1.5.7 1.5.8 1.5.9 1.6 1.6.1 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.8.1 1.9 1.9.10 1.9.12 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.9 2.0 2.0.2 2.0.3 2.1 2.1.1 2.10.0 2.10.1 2.10.2 2.10.3 2.11.1 2.12.1 2.12.2 2.13.0 2.14.0 2.15.0 2.16.0 2.17.0 2.18.0 2.18.2 2.19.0 2.19.1 2.19.2 2.2 2.2.1 2.20.0 2.21.0 2.22.0 2.23.0 2.3 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.30.0 2.31.0 2.32.0 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.40.0 2.41.0 2.42.0 2.43.0 2.5.0 2.5.1 2.5.2 2.6.0 2.6.1 2.7.0 2.7.1 2.8.0 2.8.1 2.9.0 2.9.1
capability-manager-enhanced / includes / admin.php
capability-manager-enhanced / includes Last commit date
admin.php 13 years ago author-widget.php 13 years ago backup.php 13 years ago manager.php 13 years ago
admin.php
610 lines
1 <?php
2 /**
3 * General Admin for Capability Manager.
4 * Provides admin pages to create and manage roles and capabilities.
5 *
6 * @version $Rev: 198515 $
7 * @author Jordi Canals, Kevin Behrens
8 * @copyright Copyright (C) 2009, 2010 Jordi Canals, (C) 2012 Kevin Behrens
9 * @license GNU General Public License version 2
10 * @link http://agapetry.net
11 *
12
13 Copyright 2009, 2010 Jordi Canals <devel@jcanals.cat>
14 Modifications Copyright 2012, Kevin Behrens <kevin@agapetry.net>
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 $roles = $this->roles;
30 $default = $this->current;
31
32 if( defined('PP_VERSION') ) {
33 global $wpdb;
34
35 $pp_supplemental_roles = $wpdb->get_col( "SELECT role_name FROM $wpdb->pp_roles AS r INNER JOIN $wpdb->pp_groups AS g ON g.ID = r.group_id AND r.group_type = 'pp_group' AND r.scope = 'site' WHERE g.metagroup_type = 'wp_role' AND g.metagroup_id = '$default'" );
36 //dump($pp_supplemental_roles);
37
38 $pp_filtered_types = pp_get_enabled_types('post');
39 $pp_metagroup_caps = array();
40 $pp_cap_caster = pp_init_cap_caster();
41
42 foreach( $pp_supplemental_roles as $_role_name ) {
43 $role_specs = explode( ':', $_role_name );
44 if ( empty($role_specs[2]) || ! in_array( $role_specs[2], $pp_filtered_types ) )
45 continue;
46
47 // add all type-specific caps whose base property cap is included in this pattern role
48 // i.e. If 'edit_posts' is in the pattern role, grant $type_obj->cap->edit_posts
49 $pp_metagroup_caps = array_merge( $pp_metagroup_caps, array_fill_keys( $pp_cap_caster->get_typecast_caps( $_role_name, 'site' ), true ) );
50 }
51 } else {
52 $pp_metagroup_caps = array();
53 }
54
55 ?>
56 <div class="wrap">
57 <?php if( defined('PP_VERSION') ) :
58 pp_icon();
59 $style = 'style="height:60px;"';
60 ?>
61 <?php else:
62 $style = '';
63 ?>
64 <div id="icon-capsman-admin" class="icon32"></div>
65 <?php endif; ?>
66
67 <h2 <?php echo $style;?>><?php _e('Roles and Capabilities', $this->ID) ?></h2>
68
69 <form method="post" action="admin.php?page=<?php echo $this->ID ?>">
70 <?php wp_nonce_field('capsman-general-manager'); ?>
71 <fieldset>
72 <table id="akmin">
73 <tr>
74 <td class="content">
75 <dl>
76 <dt><?php printf(__('Capabilities for %s', $this->ID), $roles[$default]); ?></dt>
77 <dd>
78 <?php
79 if ( defined( 'PP_VERSION' ) ) {
80 if ( pp_get_option('display_hints') ) {
81 echo '<div>';
82 _e( 'Use this form to view and modify the capabilities WordPress natively associates with each role. Note:', $this->ID );
83 echo '</div><br />';
84 echo '<ul class="ul-disc"><li>';
85
86 if ( pp_get_option( 'advanced_options' ) )
87 $parenthetical = sprintf( __( 'see %1$sRole Usage%2$s: "Pattern Roles"', 'pp' ), "<a href='" . admin_url('admin.php?page=pp-role-usage') . "'>", '</a>' );
88 else
89 $parenthetical = sprintf( __( 'activate %1$sAdvanced settings%2$s, see Role Usage', 'pp' ), "<a href='" . admin_url('admin.php?page=pp-settings&pp_tab=advanced') . "'>", '</a>' );
90
91 printf( __( '"Posts" capabilities selected here also define type-specific role assignment for Permit Groups (%s).', $this->ID ), $parenthetical ) ;
92 echo '</li><li>';
93 printf( __( 'Capabilities for custom statuses can be manually added to a role here (see Conditions > Capability Mapping for applicable names). However, it is usually more convenient to use Permit Groups to assign a supplemental status-specific role.', $this->ID ), "<a href='" . admin_url('?page=pp-role-usage') . "'>", '</a>' ) ;
94 echo '</li></ul>';
95 }
96 } else {
97 echo '<div>';
98 _e( "Interested in further customizing editing or viewing access? Consider stepping up to <a href='#pp-more'>Press Permit</a>.", $this->ID );
99 echo '</div>';
100 ?>
101 <script type="text/javascript">
102 /* <![CDATA[ */
103 jQuery(document).ready( function($) {
104 $('a[href=#pp-more]').click( function() {
105 $('#pp_features').show();
106 return false;
107 });
108 $('a[href=#pp-hide]').click( function() {
109 $('#pp_features').hide();
110 return false;
111 });
112 });
113 /* ]]> */
114 </script>
115 <?php
116 echo '<br /><div style="display:none" id="pp_features"><ul class="ul-disc">';
117 echo '<li>';
118 _e( "Automatically define type-specific capabilities for your custom post types and taxonomies", $this->ID );
119 echo '</li>';
120 echo '<li>';
121 _e( "Supplemental per-type, per-category or per-page role assignments", $this->ID );
122 echo '</li>';
123 echo '<li>';
124 _e( "Custom Visibility statuses (require read_member_posts, read_premium_posts, etc.)", $this->ID );
125 echo '</li>';
126 echo '<li>';
127 _e( 'Custom Editability "statuses" - set alongside Visibility in Post and Category edit forms', $this->ID );
128 echo '</li>';
129 echo '<li>';
130 _e( "Custom Moderation statuses, enabling access-limited three tier moderation (Pending / Approved / Published)", $this->ID );
131 echo '</li>';
132 echo '<li>';
133 _e( "Grant Participant or Moderator access to specific bbPress forums or topics", $this->ID );
134 echo '</li>';
135 echo '<li>';
136 _e( "Grant supplemental page or category access to all members of a BuddyPress group", $this->ID );
137 echo '</li>';
138 echo '<li>';
139 _e( "WPML integration to mirror permissions to translations", $this->ID );
140 echo '</li>';
141 echo '<li>';
142 _e( "Professional support available", $this->ID );
143 echo '</li>';
144 echo '</ul><div>';
145 echo '<a href="http://presspermit.com">http://presspermit.com</a> &bull; <a href="#pp-hide">hide</a>';
146 echo '</div></div>';
147 }
148
149 $current = get_role($default);
150 $rcaps = $current->capabilities;
151
152 // ========= Begin Kevin B mod ===========
153 $is_administrator = current_user_can( 'administrator' );
154
155 $custom_types = get_post_types( array( '_builtin' => false ), 'names' );
156 $custom_tax = get_taxonomies( array( '_builtin' => false ), 'names' );
157
158 /*
159 if ( ( count($custom_types) || count($custom_tax) ) && ( $is_administrator || current_user_can( 'manage_pp_settings' ) ) ) {
160 $cap_properties[''] = array();
161 $force_distinct_ui = true;
162 }
163 */
164
165 $cap_properties['edit']['type'] = array( 'edit_posts', 'edit_others_posts' );
166 $cap_properties['edit']['type'] = array_merge( $cap_properties['edit']['type'], array( 'publish_posts', 'edit_published_posts', 'edit_private_posts' ) );
167
168 $cap_properties['edit']['taxonomy'] = array( 'manage_terms' );
169
170 if ( ! defined( 'PP_VERSION' ) )
171 $cap_properties['edit']['taxonomy'] = array_merge( $cap_properties['edit']['taxonomy'], array( 'edit_terms', 'assign_terms' ) );
172
173 $cap_properties['delete']['type'] = array( 'delete_posts', 'delete_others_posts' );
174 $cap_properties['delete']['type'] = array_merge( $cap_properties['delete']['type'], array( 'delete_published_posts', 'delete_private_posts' ) );
175
176 if ( ! defined( 'PP_VERSION' ) )
177 $cap_properties['delete']['taxonomy'] = array( 'delete_terms' );
178 else
179 $cap_properties['delete']['taxonomy'] = array();
180
181 $cap_properties['read']['type'] = array( 'read_private_posts' );
182 $cap_properties['read']['taxonomy'] = array();
183
184 $stati = get_post_stati( array( 'internal' => false ) );
185
186 //if ( count($stati) > 5 ) {
187 $cap_type_names = array(
188 '' => __( '&nbsp;', $this->ID ),
189 'read' => __( 'Reading', $this->ID ),
190 'edit' => __( 'Editing Capabilities', $this->ID ),
191 'delete' => __( 'Deletion Capabilities', $this->ID )
192 );
193
194 //} else {
195
196 //}
197
198 $cap_tips = array(
199 'read_private' => __( 'can read posts which are currently published with private visibility', $this->ID ),
200 'edit' => __( 'has basic editing capability (but may need other capabilities based on post status and ownership)', $this->ID ),
201 'edit_others' => __( 'can edit posts which were created by other users', $this->ID ),
202 'edit_published' => __( 'can edit posts which are currently published', $this->ID ),
203 'edit_private' => __( 'can edit posts which are currently published with private visibility', $this->ID ),
204 'publish' => __( 'can make a post publicly visible', $this->ID ),
205 'delete' => __( 'has basic deletion capability (but may need other capabilities based on post status and ownership)', $this->ID ),
206 'delete_others' => __( 'can delete posts which were created by other users', $this->ID ),
207 'delete_published' => __( 'can delete posts which are currently published', $this->ID ),
208 'delete_private' => __( 'can delete posts which are currently published with private visibility', $this->ID ),
209 );
210
211 $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',
212 'read_private_pages', 'edit_pages', 'edit_others_pages', 'edit_published_pages', 'edit_private_pages', 'publish_pages', 'delete_pages', 'delete_others_pages', 'delete_published_pages', 'delete_private_pages',
213 'manage_categories'
214 );
215 $type_caps = array();
216
217 $defined = array();
218 $defined['type'] = get_post_types( array( 'public' => true ), 'object' );
219 $defined['taxonomy'] = get_taxonomies( array( 'public' => true ), 'object' );
220
221 // Press Permit grants attachment capabilities based on user's capabilities for the parent post
222 if ( defined( 'PP_VERSION' ) || defined('SCOPER_VERSION') )
223 unset( $defined['type']['attachment'] );
224
225 echo '<ul class="cme-listhoriz">';
226
227 // cap_types: read, edit, deletion
228 foreach( array_keys($cap_properties) as $cap_type ) {
229 echo '<li>';
230 echo '<h3>' . $cap_type_names[$cap_type] . '</h3>';
231 echo '<table class="cme-typecaps">';
232
233 foreach( array_keys($defined) as $item_type ) {
234 if ( ( 'delete' == $cap_type ) && ( 'taxonomy' == $item_type ) )
235 continue;
236
237 //if ( ! $cap_type ) {
238
239 //} else {
240 echo '<th></th>';
241
242 if ( ! count( $cap_properties[$cap_type][$item_type] ) )
243 continue;
244
245 // label cap properties
246 foreach( $cap_properties[$cap_type][$item_type] as $prop ) {
247 $prop = str_replace( '_posts', '', $prop );
248 $prop = str_replace( '_pages', '', $prop );
249 $prop = str_replace( '_terms', '', $prop );
250 $tip = ( isset( $cap_tips[$prop] ) ) ? "title='{$cap_tips[$prop]}'" : '';
251 $prop = str_replace( '_', '<br />', $prop );
252 echo "<th $tip>";
253 echo ucwords($prop);
254 echo '</th>';
255 }
256
257 foreach( $defined[$item_type] as $key => $type_obj ) {
258 $row = '<tr>';
259
260 if ( $cap_type ) {
261 if ( empty($force_distinct_ui) && empty( $cap_properties[$cap_type][$item_type] ) )
262 continue;
263
264 $row .= "<td><a class='cap_type' href='#toggle_type_caps'>" . $type_obj->labels->name . '</a></td>';
265
266 $display_row = ! empty($force_distinct_ui);
267
268 foreach( $cap_properties[$cap_type][$item_type] as $prop ) {
269 $row .= '<td>';
270 if ( ! empty($type_obj->cap->$prop) && ( in_array( $type_obj->name, array( 'post', 'page' ) )
271 || ! in_array( $type_obj->cap->$prop, $default_caps )
272 || ( ( 'manage_categories' == $type_obj->cap->$prop ) && ( 'manage_terms' == $prop ) && ( 'category' == $type_obj->name ) ) ) ) {
273 $cap_name = $type_obj->cap->$prop;
274
275 if ( $is_administrator || current_user_can($cap_name) ) {
276 if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
277 $title_text = sprintf( __( '%s: assigned by Permit Group', 'pp' ), $cap_name );
278 $disabled = 'disabled="disabled"';
279 $checked = ' checked="checked"';
280 } else {
281 $title_text = $cap_name;
282 $disabled = '';
283 $checked = checked(1, ! empty($rcaps[$cap_name]), false );
284 }
285
286 $row .= '<input id=caps[' . $cap_name . '] type="checkbox" title="' . $title_text . '" name="caps[' . $cap_name . ']" value="1" ' . $checked . $disabled . ' />';
287 $type_caps [$cap_name] = true;
288 $display_row = true;
289 }
290 }
291 $row .= '</td>';
292 }
293 }
294
295 if ( $display_row ) {
296 $row .= '</tr>';
297 echo $row;
298 }
299 }
300 //} // endif this iteration is for type caps checkbox display
301
302 } // end foreach item type
303
304 echo '</table>';
305
306 echo '</li>';
307 }
308
309 echo '</ul>';
310
311 // clicking on post type name toggles corresponding checkbox selections
312 ?>
313 <script type="text/javascript">
314 /* <![CDATA[ */
315 jQuery(document).ready( function($) {
316 $('a[href="#toggle_type_caps"]').click( function() {
317 var chks = $(this).closest('tr').find('input');
318 $(chks).attr( 'checked', ! $(chks).first().attr('checked') );
319 return false;
320 });
321 });
322 /* ]]> */
323 </script>
324 <?php
325
326 $core_caps = array_fill_keys( array( 'switch_themes', 'edit_themes', 'activate_plugins', 'edit_plugins', 'edit_users', 'edit_files', 'manage_options', 'moderate_comments',
327 'manage_links', 'upload_files', 'import', 'unfiltered_html', 'read', 'delete_users', 'create_users', 'unfiltered_upload', 'edit_dashboard',
328 'update_plugins', 'delete_plugins', 'install_plugins', 'update_themes', 'install_themes',
329 'update_core', 'list_users', 'remove_users', 'add_users', 'promote_users', 'edit_theme_options', 'delete_themes', 'export' ), true );
330
331 ksort( $core_caps );
332
333 echo '<p>&nbsp;</p><h3>' . __( 'Other WordPress Core Capabilities', $this->ID ) . '</h3>';
334 echo '<table width="100%" class="form-table"><tr>';
335
336
337 $checks_per_row = $this->getOption( 'form-rows' );
338 $i = 0;
339
340 foreach( array_keys($core_caps) as $cap_name ) {
341 if ( ! $is_administrator && ! current_user_can($cap_name) )
342 continue;
343
344 if ( $i == $checks_per_row ) {
345 echo '</tr><tr>';
346 $i = 0;
347 }
348
349 if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
350 $title_text = sprintf( __( '%s: assigned by Permit Group', 'pp' ), $cap_name );
351 $disabled = 'disabled="disabled"';
352 $checked = ' checked="checked"';
353 } else {
354 $title_text = $cap_name;
355 $disabled = '';
356 $checked = checked(1, ! empty($rcaps[$cap_name]), false );
357 }
358
359 $class = ( ! empty($rcaps[$cap_name]) || ! empty($pp_metagroup_caps[$cap_name]) ) ? 'cap_yes' : 'cap_no';
360 echo "<td class='$class' title='$title_text'>";
361 echo ( '<input id=caps[' . $cap_name . '] type="checkbox" name="caps[' . $cap_name . ']" value="1" ' . $checked . $disabled . ' /> ' );
362 echo str_replace( '_', ' ', $cap_name );
363 echo '</td>';
364 $i++;
365 }
366
367 echo '</table>';
368
369 echo '<p>&nbsp;</p><h3>' . __( 'Additional Capabilities', $this->ID ) . '</h3>';
370
371 ?>
372 <table width='100%' class="form-table">
373 <tr>
374 <?php
375 $i = 0; $first_row = true;
376
377 foreach ( $this->capabilities as $cap_name => $cap ) :
378 if ( isset( $type_caps[$cap_name] ) || isset($core_caps[$cap_name]) )
379 continue;
380
381 if ( ! $is_administrator && ! current_user_can($cap_name) )
382 continue;
383
384 // ============ End Kevin B mod ===============
385
386 // Levels are not shown.
387 if ( preg_match( '/^level_(10|[0-9])$/i', $cap_name ) ) {
388 continue;
389 }
390
391 if ( $i == $checks_per_row ) {
392 echo '</tr><tr>';
393 $i = 0; $first_row = false;
394 }
395 //$style = ( ! empty($rcaps[$cap_name]) || ! empty($pp_metagroup_caps[$cap_name]) ) ? 'color:green;font-weight:bold;' : 'color:red;';
396 $class = ( ! empty($rcaps[$cap_name]) || ! empty($pp_metagroup_caps[$cap_name]) ) ? 'cap_yes' : 'cap_no';
397
398 if ( ! empty($pp_metagroup_caps[$cap_name]) ) {
399 $title_text = sprintf( __( '%s: assigned by Permit Group', 'pp' ), $cap_name );
400 $disabled = 'disabled="disabled"';
401 $checked = ' checked="checked"';
402 } else {
403 $title_text = $cap_name;
404 $disabled = '';
405 $checked = checked(1, ! empty($rcaps[$cap_name]), false );
406 }
407
408 if ( 'manage_capabilities' == $cap_name ) {
409 if ( ! current_user_can('administrator') ) {
410 continue;
411 } elseif ( 'administrator' == $default ) {
412 $lock_manage_caps_capability = true;
413 $disabled = 'disabled="disabled"';
414 }
415 }
416 ?>
417 <td class="<?php echo $class; ?>"><label for="caps[<?php echo $cap_name; ?>]" title="<?php echo $title_text;?>"><input id=caps[<?php echo $cap_name; ?>] type="checkbox" name="caps[<?php echo $cap_name; ?>]" value="1" <?php echo $checked . $disabled;?> />
418 <?php
419 echo $cap;
420 ?></label></td>
421 <?php
422 $i++;
423 endforeach;
424
425 if ( ! empty($lock_manage_caps_capability) ) {
426 echo '<input type="hidden" name="caps[manage_capabilities]" value="1" />';
427 }
428
429 if ( $i == $checks_per_row ) {
430 echo '</tr><tr>';
431 $i = 0;
432 }
433
434 $level = ak_caps2level($rcaps);
435 ?>
436 <td><?php _e('Level:', $this->ID) ;?><select name="level">
437 <?php for ( $l = $this->max_level; $l >= 0; $l-- ) {?>
438 <option value="<?php echo $l; ?>" style="text-align:right;"<?php selected($level, $l); ?>>&nbsp;<?php echo $l; ?>&nbsp;</option>
439 <?php }
440 ++$i;
441
442 if ( ! $first_row ) {
443 // Now close a wellformed table
444 for ( $i; $i < $checks_per_row; $i++ ){
445 echo '<td>&nbsp;</td>';
446 }
447 }
448 ?>
449 </select>
450
451 </tr>
452 </table>
453
454 <br />
455 <?php if ( ! defined('PP_VERSION') || pp_get_option('display_hints') ) :?>
456 <div class="cme-subtext">
457 <?php _e( 'Note: Underscores replace spaces in stored capability name ("edit users" => "edit_users").', 'pp' ); ?>
458 </div>
459 <?php endif;?>
460 </span>
461
462 </dd>
463 </dl>
464
465 <?php
466 $support_pp_only_roles = defined('PP_VERSION') && version_compare( PP_VERSION, '1.0-beta1.4', '>=');
467 ?>
468
469 <?php if ( $support_pp_only_roles && ! in_array( $default, array( 'subscriber', 'contributor', 'author', 'editor', 'administrator' ) ) ) : ?>
470 <div style="float:right">
471 <?php
472 $pp_only = (array) pp_get_option( 'supplemental_role_defs' );
473 $checked = ( in_array( $default, $pp_only ) ) ? 'checked="checked"': '';
474 ?>
475 <label for="pp_only_role" title="<?php _e('Make role available for supplemental assignment to Permit Groups only', 'pp');?>"><input type="checkbox" name="pp_only_role" id="pp_only_role" value="1" <?php echo $checked;?>> <?php _e('supplemental assignment only', 'pp'); ?> </label>
476 </div>
477 <?php endif; ?>
478
479 <p class="submit">
480 <input type="hidden" name="action" value="update" />
481 <input type="hidden" name="current" value="<?php echo $default; ?>" />
482 <input type="submit" name="Save" value="<?php _e('Save Changes', $this->ID) ?>" class="button-primary" /> &nbsp;
483
484 <?php if ( current_user_can('administrator') && 'administrator' != $default ) : ?>
485 <a class="ak-delete" title="<?php echo esc_attr(__('Delete this role', $this->ID)) ?>" href="<?php echo wp_nonce_url("admin.php?page={$this->ID}&amp;action=delete&amp;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.", $this->ID), $roles[$default])); ?>') ) { return true;}return false;"><?php _e('Delete Role', $this->ID)?></a>
486 <?php endif; ?>
487 </p>
488
489 <br />
490 <?php ak_admin_footer($this->ID, 2009); ?>
491
492 </td>
493 <td class="sidebar">
494 <?php ak_admin_authoring($this->ID); ?>
495
496 <dl>
497 <dt><?php defined('WPLANG') && WPLANG ? _e('Select New Role', $this->ID) : _e('Select Role to View / Edit', $this->ID); ?></dt>
498 <dd style="text-align:center;">
499 <p><select name="role">
500 <?php
501 foreach ( $roles as $role => $name ) {
502 echo '<option value="' . $role .'"'; selected($default, $role); echo '> ' . $name . ' &nbsp;</option>';
503 }
504 ?>
505 </select><span style="margin-left:20px"><input type="submit" name="Load" value="<?php defined('WPLANG') && WPLANG ? _e('Change', $this->ID) : _e('Load', $this->ID) ?>" class="button" /></span></p>
506 </dd>
507 </dl>
508
509 <dl>
510 <dt><?php _e('Create New Role', $this->ID); ?></dt>
511 <dd style="text-align:center;">
512 <?php $class = ( $support_pp_only_roles ) ? 'tight-text' : 'regular-text'; ?>
513 <p><input type="text" name="create-name"" class="<?php echo $class;?>" placeholder="<?php _e('Name of new role', $this->ID) ?>" />
514
515 <?php if( $support_pp_only_roles ) : ?>
516 <label for="new_role_pp_only" title="<?php _e('Make role available for supplemental assignment to Permit Groups only', 'pp');?>"> <input type="checkbox" name="new_role_pp_only" id="new_role_pp_only" value="1" checked="checked"> <?php _e('supplemental', 'pp'); ?> </label>
517 <?php endif; ?>
518
519 <br />
520 <input type="submit" name="Create" value="<?php _e('Create', $this->ID) ?>" class="button" />
521 </p>
522 </dd>
523 </dl>
524
525 <dl>
526 <dt><?php defined('WPLANG') && WPLANG ? _e('Copy this role to', $this->ID) : printf( __('Copy %s Role', $this->ID), $roles[$default]); ?></dt>
527 <dd style="text-align:center;">
528 <?php $class = ( $support_pp_only_roles ) ? 'tight-text' : 'regular-text'; ?>
529 <p><input type="text" name="copy-name" class="<?php echo $class;?>" placeholder="<?php _e('Name of copied role', $this->ID) ?>" />
530
531 <?php if( $support_pp_only_roles ) : ?>
532 <label for="new_role_pp_only" title="<?php _e('Make role available for supplemental assignment to Permit Groups only', 'pp');?>"> <input type="checkbox" name="new_role_pp_only" id="new_role_pp_only" value="1" checked="checked"> <?php _e('supplemental', 'pp'); ?> </label>
533 <?php endif; ?>
534
535 <br />
536 <input type="submit" name="Copy" value="<?php _e('Copy', $this->ID) ?>" class="button" />
537 </p>
538 </dd>
539 </dl>
540
541 <dl>
542 <dt><?php _e('Add Capability', $this->ID); ?></dt>
543 <dd style="text-align:center;">
544 <p><input type="text" name="capability-name" class="regular-text" placeholder="<?php _e('capability name', $this->ID) ?>" /><br />
545 <input type="submit" name="AddCap" value="<?php _e('Add to role', $this->ID) ?>" class="button" /></p>
546 </dd>
547 </dl>
548
549 <?php if ( defined('PP_VERSION') && current_user_can( 'pp_manage_settings' ) ) :?>
550 <dl>
551 <dt><?php _e('Force Type-Specific Capabilities', $this->ID); ?></dt>
552 <dd style="text-align:center;">
553 <?php
554 $caption = __( 'Force unique capability names for:', 'pp' );
555 echo "<p>$caption</p><table style='width:100%'><tr>";
556
557 foreach( array_keys($defined) as $item_type ) {
558 echo '<td style="width:50%">';
559 $option_name = ( 'taxonomy' == $item_type ) ? 'enabled_taxonomies' : 'enabled_post_types';
560
561 $enabled = pp_get_option( $option_name );
562
563 foreach( $defined[$item_type] as $key => $type_obj ) {
564 if ( ! $key )
565 continue;
566
567 $id = "$option_name-" . $key;
568 ?>
569 <div style="text-align:left">
570 <?php if ( 'nav_menu' == $key ) :?>
571 <input name="<?php echo($id);?>" type="hidden" id="<?php echo($id);?>" value="1" />
572 <input name="<?php echo("{$option_name}-options[]");?>" type="hidden" value="<?php echo($key)?>" />
573
574 <?php else: ?>
575 <div class="agp-vspaced_input">
576 <label for="<?php echo($id);?>" title="<?php echo($key);?>">
577 <input name="<?php echo("{$option_name}-options[]");?>" type="hidden" value="<?php echo($key)?>" />
578 <input name="<?php echo($id);?>" type="checkbox" id="<?php echo($id);?>" value="1" <?php checked('1', isset($enabled[$key]) );?> /> <?php echo($type_obj->label);?>
579
580 <?php
581 echo ('</label></div>');
582
583 endif; // displaying checkbox UI
584
585 echo '</div>';
586 }
587 echo '</td>';
588 }
589 ?>
590 </tr></table>
591
592 <div class="cme-subtext">
593 <?php
594 if ( pp_get_option( 'display_hints' ) ) {
595 _e( '(PP Filtered Post Types, Taxonomies)', 'pp' );
596 }
597 ?>
598 </div>
599
600 <input type="submit" name="update_filtered_types" value="<?php _e('Update', $this->ID) ?>" class="button" />
601 </dd>
602 </dl>
603 <?php endif;?>
604 </td>
605 </tr>
606 </table>
607 </fieldset>
608 </form>
609 </div>
610