Opened 16 months ago

Last modified 3 months ago

#19867 new defect (bug)

wp_dropdown_users() still not scalable

Reported by: prettyboymp Owned by:
Priority: normal Milestone: Future Release
Component: Performance Version: 3.3.1
Severity: normal Keywords: ui-feedback has-patch needs-refresh
Cc: xoodrew@…, Japh, kenton.jacobsen@…, kovshenin, mpvanwinkle77, info@…

Description

#14572 made huge improvements to the performance of wp_dropdown_users(), however, on certain sites that have an unusually large set of authors, wp_dropdown_users() still isn't usable. It either causes a memory error on the server, or potentially crashes the client browser due to content size.

Attachments (4)

user_autocomplete.diff (9.2 KB) - added by prettyboymp 16 months ago.
user_dropdown_filter.diff (962 bytes) - added by prettyboymp 16 months ago.
user_autocomplete.2.diff (11.6 KB) - added by prettyboymp 16 months ago.
wp_suggest_users.alpha.1.diff (7.4 KB) - added by mpvanwinkle77 4 months ago.

Download all attachments as: .zip

Change History (22)

attachment:ticket:19867:user_autocomplete.diff is a suggested solution using an autocomplete handling to replace the select box after a threshold of results is hit.

As an alternative, I'm working on a second patch that will just be a tweak to add a filter that will a plugin to add this functionality before the dropdown is generated, in case a built in solution isn't accepted.

attachment:ticket:19867:user_dropdown_filter.diff is alternative patch to at least allow a plugin to override the user dropdown before any queries are run.

Just realized that my first patch didn't include the supporting js. Added attachment:ticket:19867:user_autocomplete.2.diff with it included.

+1 on the filter.

Additional +1 on autocomplete after a certain number of users. Since we are doing autocomplete for sites/users in the network admin for 3.4, the bits can likely be shared quite nicely.

  • Cc xoodrew@… added
  • Cc Japh added

Closed #20769 as dup.

#21286 closed as a duplicate.

  • Milestone changed from Awaiting Review to Future Release
  • Cc kenton.jacobsen@… added

#23129 was marked as a duplicate.

What's the status on this? Says targeted to 3.3.1 but it doesn't look like these changes ever made it through. I can help test if there's an approved patch for testing.

comment:14 follow-up: ↓ 15   helen4 months ago

Version is when something was reported/requested or the earliest a bug can be reproduced. Milestone is for the target, as it were.

Could probably use a patch that implements autocomplete the way it's done now for the network admin after a certain number of users. There's wp_is_large_network( 'users' ) to check for a large number of users but the default of 10k is probably still way too many for a dropdown.

comment:15 in reply to: ↑ 14   kovshenin4 months ago

  • Cc kovshenin added
  • Keywords needs-refresh added

Replying to helen: I think wp_is_large_network is actually used to prevent autocomplete because such searches would be really slow on large databases. Here's site-users.php:

if ( ! wp_is_large_network( 'users' ) )
	wp_enqueue_script( 'user-suggest' );

We can probably just reuse the whole thing as is, with a different ajax callback.

  • Cc mpvanwinkle77 added

So here's a new approach. creates a new function wp_suggest_users ... allows for several criterion in wp_dropdown_users to initiate a bail to wp_suggest_users() ... minor updates to js and to wp-admin/includes/post.php required to make this work. There's still a lot to do to make this production ready, but wanted to get some general feed back on the approach before continuing.

#23439 was marked as a duplicate.

  • Cc info@… added
Note: See TracTickets for help on using tickets.