Skip to content

Commit

Permalink
Ensure that the group sync processes work for single site installations.
Browse files Browse the repository at this point in the history
  • Loading branch information
imcbride committed Aug 6, 2024
1 parent fe3284c commit a3a6672
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/DynamicAddUsers/GroupSyncer.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,10 @@ public function syncUser ($user_id, array $group_ids) {
$this->userManager->addUserToBlog($user, $role_to_ensure->role, $role_to_ensure->blog_id, $role_to_ensure->group_id);
}
}
// Switch back to the current blog if we left it.
restore_current_blog();
if ( is_multisite() ) {
// Switch back to the current blog if we left it.
restore_current_blog();
}

// Get a list of the blogs where the user was previously added, but is no longer
// in one of the groups
Expand Down Expand Up @@ -211,8 +213,10 @@ public function syncUser ($user_id, array $group_ids) {
}
}

// Switch back to the current blog if we left it.
restore_current_blog();
if ( is_multisite() ) {
// Switch back to the current blog if we left it.
restore_current_blog();
}
}

/**
Expand Down

0 comments on commit a3a6672

Please sign in to comment.