You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.
I use your plugin on a WP Multisite and I noticed that capabilities modifications applied on one site are not reported on all network's sites.
This is good to not "force" syncing roles : we could want to have differents roles settings accross all networks sites, but, I think - and this is my case - that we could also prefer to sync this setting to not re-apply manually capabilities for each network site.
I use your hook members_role_updated to loop on each site and register option.
I think it could be good to add it on your plugin, with a checkbox on settings page to allow/disallow this synchonization.
add_action('members_role_updated', 'sync_members_roles', 10, 1); function sync_members_roles($role){ global $wp_roles; $current_roles = $wp_roles->roles; // Loop all sites except current : $sites = get_sites( array( 'site__not_in' => array( get_current_blog_id() ) ) ); foreach ( $sites as $site ) { switch_to_blog( $site->blog_id ); global $wpdb; $option_name = $wpdb->prefix . 'user_roles'; update_option( $option_name, $current_roles ); } restore_current_blog(); }
The text was updated successfully, but these errors were encountered:
One thing you'd definitely need there is an is_super_admin() check. That code might be all right for a one-off site that you're in control of though.
Ideally, we'd need something like a setting in the network admin. This shouldn't be a setting that's applied to individual blogs in the network.
Moreover, it'd probably be a better idea to have a role management system within the network admin itself for super admins to control. Some items to consider:
Should be able to apply the role to all blogs in the network or, perhaps, just some blogs.
Super admin should have the ability to create both Editable and Uneditable roles.
Editable roles can be edited or deleted on a per-blog basis.
Hello,
I use your plugin on a WP Multisite and I noticed that capabilities modifications applied on one site are not reported on all network's sites.
This is good to not "force" syncing roles : we could want to have differents roles settings accross all networks sites, but, I think - and this is my case - that we could also prefer to sync this setting to not re-apply manually capabilities for each network site.
I use your hook members_role_updated to loop on each site and register option.
I think it could be good to add it on your plugin, with a checkbox on settings page to allow/disallow this synchonization.
add_action('members_role_updated', 'sync_members_roles', 10, 1);
function sync_members_roles($role){
global $wp_roles;
$current_roles = $wp_roles->roles;
// Loop all sites except current :
$sites = get_sites( array( 'site__not_in' => array( get_current_blog_id() ) ) );
foreach ( $sites as $site ) {
switch_to_blog( $site->blog_id );
global $wpdb;
$option_name = $wpdb->prefix . 'user_roles';
update_option( $option_name, $current_roles );
}
restore_current_blog();
}
The text was updated successfully, but these errors were encountered: