PluginProbe ʕ •ᴥ•ʔ
PublishPress Capabilities – User Role Editor, Access Permissions, User Capabilities, Admin Menus / 1.5.4
PublishPress Capabilities – User Role Editor, Access Permissions, User Capabilities, Admin Menus v1.5.4
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 / network.php
capability-manager-enhanced / includes Last commit date
admin.php 10 years ago backup-handler.php 10 years ago backup.php 10 years ago handler.php 10 years ago manager.php 10 years ago network.php 10 years ago pp-handler.php 10 years ago pp-ui.php 10 years ago
network.php
76 lines
1 <?php
2 add_action( 'wpmu_new_blog', '_cme_new_blog' );
3 function _cme_new_blog( $new_blog_id ) {
4 if ( $autocreate_roles = get_site_option( 'cme_autocreate_roles' ) ) {
5 global $wp_roles, $blog_id;
6
7 $restore_blog_id = $blog_id;
8
9 switch_to_blog( 1 );
10 $wp_roles->reinit();
11
12 $main_site_caps = array();
13 $role_captions = array();
14
15 $admin_role = $wp_roles->get_role('administrator');
16 $main_admin_caps = $admin_role->capabilities;
17
18 if ( defined('PP_ACTIVE') )
19 $main_pp_only = (array) pp_get_option( 'supplemental_role_defs' );
20 //$pp_only[]= $newrole;
21
22 foreach( $autocreate_roles as $role_name ) {
23 if ( $role = get_role( $role_name ) ) {
24 $main_site_caps[$role_name] = $role->capabilities;
25 $role_captions[$role_name] = $wp_roles->role_names[$role_name];
26 }
27 }
28
29 switch_to_blog($new_blog_id);
30 $wp_roles->reinit();
31
32 if ( defined('PP_ACTIVE') ) {
33 pp_refresh_options();
34 $blog_pp_only = (array) pp_get_option( 'supplemental_role_defs' );
35 }
36
37 foreach( $main_site_caps as $role_name => $caps ) {
38 if ( $blog_role = $wp_roles->get_role( $role_name ) ) {
39 $stored_role_caps = ( ! empty($blog_role->capabilities) && is_array($blog_role->capabilities) ) ? array_intersect( $blog_role->capabilities, array(true, 1) ) : array();
40
41 // Find caps to add and remove
42 $add_caps = array_diff_key($caps, $stored_role_caps);
43 $del_caps = array_intersect_key( array_diff_key($stored_role_caps, $caps), $main_admin_caps ); // don't mess with caps that are totally unused on main site
44
45 // Add new capabilities to role
46 foreach ( $add_caps as $cap => $grant )
47 $blog_role->add_cap($cap);
48
49 // Remove capabilities from role
50 foreach ( $del_caps as $cap => $grant)
51 $blog_role->remove_cap($cap);
52 } else {
53 $wp_roles->add_role( $role_name, $role_captions[$role_name], $caps );
54 }
55
56 if ( defined('PP_ACTIVE') ) {
57 if ( in_array( $role_name, $main_pp_only ) ) {
58 _cme_pp_default_pattern_role( $role_name );
59 $blog_pp_only []= $role_name;
60 } else
61 array_diff( $blog_pp_only, array( $role_name ) );
62 }
63 }
64
65 if ( defined('PP_ACTIVE') )
66 pp_update_option( 'supplemental_role_defs', $blog_pp_only );
67
68 switch_to_blog($restore_blog_id);
69 $wp_roles->reinit();
70
71 if ( defined('PP_ACTIVE') )
72 pp_refresh_options();
73 }
74 }
75
76