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