Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Role mapping does not restore_current_blog() #90

Open
roborourke opened this issue Jan 15, 2025 · 1 comment · May be fixed by #93
Open

Role mapping does not restore_current_blog() #90

roborourke opened this issue Jan 15, 2025 · 1 comment · May be fixed by #93
Labels

Comments

@roborourke
Copy link
Contributor

The map_user_roles() function does not restore_current_blog() after looping over the sites, which might cause problems with subsequent logic that checks the current blog ID and whether the user is a member.

@roborourke roborourke added the bug label Jan 15, 2025
@rmccue
Copy link
Member

rmccue commented Jan 15, 2025

Oh wow, this is a very big problem.

roborourke added a commit that referenced this issue Jan 15, 2025
* Stops overriding the full `$roles` array when removing `superadmin` from the list of roles to assign.
* Uses `add_user_to_blog()` for the initial role so that default site user meta and caches are created properly
* Restores the current blog so that subsequent logic eg. adding user to current site with default role behaves as expected

Fixes #90
@roborourke roborourke linked a pull request Jan 15, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants