Make WordPress Core

Opened 13 years ago

Closed 11 years ago

#16366 closed enhancement (fixed)

Search Users box on ms-users.php doesn't search all fields

Reported by: novasource's profile novasource Owned by: nacin's profile nacin
Milestone: 3.6 Priority: normal
Severity: normal Version: 3.0.4
Component: Network Admin Keywords: has-patch commit
Focuses: multisite Cc:

Description

The Search Users box on ms-users.php isn't working for valid search terms.

I have a user with these fields:
Username: 12345678 (it's from our LDAP provider)
Name: Smith, John (again, convoluted, but it's from LDAP)
E-mail: john@…

What actually happens: If I search on smith or john smith, I get no results. But if I search on john, I see his account.

What should happen: All three of those search terms should have showed John Smith's account.

Attachments (3)

16366.diff (534 bytes) - added by greuben 13 years ago.
16366.2.diff (454 bytes) - added by SergeyBiryukov 13 years ago.
16366.3.diff (454 bytes) - added by SergeyBiryukov 11 years ago.
Refreshed

Download all attachments as: .zip

Change History (19)

#2 @greuben
13 years ago

What actually happens: If I search on smith or john smith, I get no results. But if I search on john, I see his account.

I think "john" is the user_nicename. WP_User_Query doesn't search for display_name that is why "smith" and "john smith" return zero results.

@greuben
13 years ago

#3 @greuben
13 years ago

  • Keywords has-patch added

#4 @westi
13 years ago

This won't scale as there is no index on the column in the database.

Therefore this isn't suitable for core - we could probably add a filter on the array of columns instead so you can add them if you want and don't care about the possibly deadly slow queries.

#5 @nacin
13 years ago

History: #15170

#6 @ryan
13 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

#7 @novasource
13 years ago

  • Resolution wontfix deleted
  • Status changed from closed to reopened

Hold on a sec. Where's the feature request for westi's comment above?

#8 @SergeyBiryukov
13 years ago

Added patch with a filter.

#9 @ocean90
13 years ago

  • Milestone set to Future Release
  • Type changed from defect (bug) to enhancement

#10 @F J Kaiser
13 years ago

  • Cc 24-7@… added

#11 @mordauk
12 years ago

  • Cc pippin@… added

#12 @SergeyBiryukov
12 years ago

#22309 was marked as a duplicate.

#13 @aaroncampbell
11 years ago

This filter would be really nice to have. The argument westi made of not having an index on certain columns makes sense, but should also apply to user_email and user_url...both of which have since been added to the allowed list which is now:

array( 'ID', 'user_login', 'user_email', 'user_url', 'user_nicename' )

Also, it's relatively easy for a specific site to add the necessary index if it's something they need.

+1 for adding the user_search_columns filter

#14 @SergeyBiryukov
11 years ago

  • Milestone changed from Future Release to 3.6

@SergeyBiryukov
11 years ago

Refreshed

#15 @SergeyBiryukov
11 years ago

  • Keywords commit added

#16 @nacin
11 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from reopened to closed

In 24056:

Add user_search_columns filter to WP_User_Query::prepare_query().

props aaroncampbell.
fixes #16366.

Note: See TracTickets for help on using tickets.