Opened 6 years ago
Last modified 3 years ago
#45640 assigned enhancement
get_blogs_of_user improvements
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | minor | Version: | 3.0 |
Component: | Networks and Sites | Keywords: | needs-unit-tests has-patch needs-refresh |
Focuses: | multisite | Cc: |
Description
get_blogs_of_user function is often pulling more data than it needs. This often won't cause any issues but in some cases when user is attached to big number of blogs, it may lead to out of memory error.
Attached patch has changes that can lead to more improvements like pagination for "My Sites" admin page, limitation of listed sites in admin bar and on "access denied" page.
Attachments (2)
Change History (7)
#1
@
6 years ago
- Keywords needs-unit-tests added
- Version changed from trunk to 3.0
Hi @maniu, thanks for your ticket! There are definitely improvements to be made around querying sites across a network and improvements to get_blogs_of_user()
are likely part of the overall multisite roadmap.
We'll probably pick up more of those discussions as we resume our weekly meetings in Slack in the new year and post 5.0.
Regarding the specific patch here, I wonder if it might make more sense to keep the second parameter as the current boolean value, and instead checking for some type of all_ids
value in the $args
array.
Mixing the type (bool, string) and usage (manipulating the returned list of sites vs returned fields) of a single parameter feels like it could easily lead to confusion.
#2
@
6 years ago
- Keywords changed from has-patch needs-unit-tests to needs-unit-tests has-patch
Hey @earnjam, yeah I think you are right. I could have avoided all_ids
as having $all = true
together with $args = array( 'fields' => 'ids' )
can cover it. I will work on another patch. Thanks!
@
6 years ago
modified version that does not include tweaks to $all parameters as they are confusing and not crucial for performance improvement.
get_blogs_of_user improvements