Skip to content

Commit

Permalink
Merge pull request #67 from humanmade/fix-multisite
Browse files Browse the repository at this point in the history
Fix roles in multisite
  • Loading branch information
roborourke authored Sep 29, 2021
2 parents 236a41b + 84d53d6 commit cf6957d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion inc/namespace.php
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,10 @@ function map_user_roles( $user, array $attributes ) {
$all_site_ids = new \WP_Site_Query( [
'network' => get_network()->id,
'fields' => 'ids',
'number' => 999,
] );

foreach ( $all_site_ids as $site_id ) {
foreach ( $all_site_ids->sites as $site_id ) {
switch_to_blog( $site_id );
$user->for_site( $site_id );
$user->set_role( reset( $roles['network'] ) );
Expand Down

0 comments on commit cf6957d

Please sign in to comment.