For non-super-admins, use get_blogs_of_user() to determine authroized sites.#1179
For non-super-admins, use get_blogs_of_user() to determine authroized sites.#1179peterwilsoncc wants to merge 9 commits intodevelopfrom
Conversation
|
@peterwilsoncc Tested and ensured that the PR is working for me. |
|
@peterwilsoncc It seems that the 1000 site limit problem will still be there for super admins, so why not query for number of sites like this and store it in transients instead of passing a static number: |
|
Thanks for looking at this @kirtangajjar. The limit of 1000 sites was added in 3077cf9. Based on the commit message it was a coding standards fix to avoid a warning for an unlimited query. I'd be surprised if many users were hitting the 1000 site limit but do you think it's worth adding a filter to allow developers to increase the size of the dropdown? |
|
Fwiw filtering for that seems like a good handling to me. |
|
@Sidsector9 checking if you can help with the review here? |
| if ( is_super_admin() ) { | ||
| $sites = get_sites( | ||
| array( | ||
| 'number' => 1000, |
There was a problem hiding this comment.
Since the original issue mentions a site that has more than 1000 sites on the network, I do think we should add a filter around this so people can increase this limit if needed
Description of the Change
Modifies the query used to determine a user's authorized sites to use
get_blogs_of_user().As super admins have access to all sites without being a member, the existing
get_sites()query is used for super admins.Closes #1176
How to test the Change
export XDEBUG_MODE=off; for i in {1..1050}; do wp site create --slug=$i --title="MS $i" --url=https://ms-distributor.local; done;(change the URL if needs be)Creating the sites may take some time so you should leave the command going and switch tasks for a while.
Changelog Entry
Credits
Props @jeffpaul, @boonebgorges, @peterwilsoncc.
Checklist: