Opened 11 years ago
Closed 11 years ago
#25128 closed defect (bug) (invalid)
Remove unreachable code in get_active_blog_for_user()
Reported by: | jeremyfelt | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Multisite | Keywords: | |
Focuses: | Cc: |
Description
get_active_blog_for_user()
accounts for a case where get_user_meta( $user_id, 'primary_blog', true );
returns false
. I believe the only possible way for this to happen is via a misguided filter on get_user_metadata
.
If for some reason false
was returned, the existing code sets the user as a subscriber on the first site it finds the user has access to, overwriting any existing capabilities. (See also #15316)
The function then returns a blog object that may not meet the full expectations of a blog object being returned by the function. (See also #18789)
The attached patch removes this extra, unnecessary code.
Attachments (1)
Change History (5)
#2
@
11 years ago
I believe the only possible way for this to happen is via a misguided filter on get_user_metadata.
It seems like this could also occur if a user simply doesn't have a primary_blog. This could happen on initial conversion from single-site to multisite, or if user tables are shared, I guess.
#4
@
11 years ago
- Keywords has-patch removed
- Milestone Awaiting Review deleted
- Resolution set to invalid
- Status changed from new to closed
- Version 3.0 deleted
If a user is a member of at least one blog, and has no primary blog assigned, then this could be reached.
I haven't tested how to trigger that scenario, but the code itself appears harmless either way.
Related: mu:1928, [16179].