PluginProbe ʕ •ᴥ•ʔ
PublishPress Capabilities – User Role Editor, Access Permissions, User Capabilities, Admin Menus / 2.22.0
PublishPress Capabilities – User Role Editor, Access Permissions, User Capabilities, Admin Menus v2.22.0
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 / pp-handler.php
capability-manager-enhanced / includes Last commit date
admin-notices 6 months ago features 6 months ago plugin-capabilities 6 months ago redirects 6 months ago roles 6 months ago admin-load.php 6 months ago admin.php 6 months ago backup-handler.php 6 months ago backup.php 6 months ago cap-helper.php 6 months ago dashboard.php 6 months ago extractor-capabilities.php 6 months ago filters-admin.php 6 months ago filters-woocommerce.php 6 months ago filters-wp_rest_workarounds.php 6 months ago filters.php 6 months ago functions-admin.php 6 months ago functions.php 6 months ago handler.php 6 months ago inflect-cme.php 6 months ago manager.php 6 months ago network.php 6 months ago plugin-capabilities.php 6 months ago pp-handler.php 6 months ago pp-ui.php 6 months ago publishpress-roles.php 6 months ago settings-handler.php 6 months ago settings-ui.php 6 months ago settings.php 6 months ago test-user-ui.php 6 months ago test-user.php 6 months ago
pp-handler.php
103 lines
1 <?php
2 /*
3 * PublishPress Capabilities [Free]
4 *
5 * Process updates to Type-Specific Types / Taxonomies, Detailed Taxonomies
6 *
7 */
8
9 function _cme_update_pp_usage() {
10 static $updated;
11 if ( ! empty($updated) ) { return true; }
12
13 check_admin_referer('capsman-general-manager');
14
15 if (!current_user_can( 'manage_capabilities' )) {
16 return false;
17 }
18
19 if ( ! empty( $_REQUEST['update_filtered_types']) || ! empty( $_REQUEST['update_filtered_taxonomies']) || ! empty($_REQUEST['update_detailed_taxonomies']) || ! empty( $_REQUEST['SaveRole']) ) {
20 // update Press Permit "Filtered Post Types". This determines whether type-specific capability definitions are forced
21 $options = array( 'enabled_post_types', 'enabled_taxonomies', 'detailed_taxonomies' );
22
23 $posted = $_POST;
24
25 $pp_prefix = (defined('PPC_VERSION') && !defined('PRESSPERMIT_VERSION')) ? 'pp' : 'presspermit';
26
27 foreach( $options as $option_basename ) {
28 if ( ! isset( $posted["{$option_basename}-options"] ) )
29 continue;
30
31 $unselected = array();
32 $value = array();
33
34 foreach( $posted["{$option_basename}-options"] as $key ) {
35 if ( ( 'enabled_taxonomies' == $option_basename ) && ! empty( $posted["detailed_taxonomies-{$key}"] ) && ! empty( $posted['update_detailed_taxonomies']) ) {
36 // if Detailed is selected, also select Type-Specific
37 $posted["enabled_taxonomies-{$key}"] = true;
38 $value[$key] = true;
39 } elseif ( ( 'detailed_taxonomies' == $option_basename ) && empty( $posted["enabled_taxonomies-{$key}"] ) && ! empty( $posted['update_filtered_taxonomies']) ) {
40 // if Enabled is deselected, also deselect Type-Specific
41 $unselected[$key] = true;
42 } elseif ( empty( $posted["{$option_basename}-$key"] ) ) {
43 $unselected[$key] = true;
44 } else {
45 $value[$key] = true;
46 }
47 }
48
49 $option_name = ( 'detailed_taxonomies' == $option_basename ) ? 'cme_' . $option_basename : $pp_prefix . '_' . $option_basename;
50
51 if ( $current = get_option( $option_name ) ) {
52 if ( $current = array_diff_key( $current, $unselected ) )
53 $value = array_merge( $current, $value ); // retain setting for any types which were previously enabled for filtering but are currently not registered
54 }
55
56 $value = array_map('sanitize_key', $value);
57
58 update_option( $option_name, $value );
59
60 if (in_array($option_name, ['presspermit_enabled_post_types', 'pp_enabled_post_types'])) {
61 // ensure smooth transition if Press Permit Core is deactivated
62 update_option( 'cme_enabled_post_types', $value );
63 }
64
65 if (defined('PRESSPERMIT_ACTIVE') && in_array($option_basename, ['enabled_post_types', 'enabled_taxonomies'])) {
66 pp_capabilities_update_permissions_option($option_basename, $value);
67 }
68
69 $updated = true;
70 }
71
72 if ( ! empty( $_REQUEST['update_filtered_types']) ) {
73 update_option( $pp_prefix . '_define_create_posts_cap', ! empty($_REQUEST['pp_define_create_posts_cap']) );
74 }
75 }
76
77 if ( defined( 'PRESSPERMIT_ACTIVE' ) ) {
78 if ( ! empty( $_REQUEST['SaveRole']) ) {
79 if ( ! empty( $_REQUEST['role'] ) ) {
80 $pp_only = (array) pp_capabilities_get_permissions_option( 'supplemental_role_defs' );
81
82 $role = sanitize_key($_REQUEST['role']);
83
84 if (empty($_REQUEST['pp_only_role'])) {
85 $pp_only = array_diff($pp_only, [$role]);
86 } else {
87 $pp_only[]= $role;
88 }
89
90 pp_capabilities_update_permissions_option('supplemental_role_defs', array_unique($pp_only));
91
92 _cme_pp_default_pattern_role($role);
93 }
94 }
95
96 if ( $updated ) {
97 pp_refresh_options();
98 }
99 }
100
101 return $updated;
102 }
103