Open peterwilsoncc opened 9 months ago
@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:
SELECT COUNT(blog_id) FROM {$wpdb->blogs} WHERE archived = '0' AND spam = '0' AND deleted = '0'
Thanks for looking at this @kirtangajjar.
The limit of 1000 sites was added in 3077cf9ae6647fc0a15ceda9b4f02813aed9a728. 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.
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: