Skip to:

Opened 4 years ago

Last modified 4 years ago

#4704 new defect (bug)

Member search on string containing apostrophe returns no results.

Reported by: kevingamin Owned by:
Milestone: Future Release Priority: normal
Severity: major Version: 1.0
Component: Members Keywords: needs-testing needs-patch


When performing a search on a Buddypress member directory with a string containing an apostrophe (ex. Tony K's), the search returns zero results. Performing a partial search (ex. Tony or Tony K) will return results, including the desired one. This affects mutilple versions and was specifically tested on 1.2.8 in WP 3.1.4 and on 1.6.1 in WP 3.4.2.

Change History (2)

#1 @DJPaul
4 years ago

Thanks for reporting this; I've seen it before, though I couldn't find an existing ticket. I'm pretty sure this will affect searches other than xprofile, but for xprofile:

1) Set xprofile name to "Paul's".
2) Look in xprofile data DB table; value is stored as "Paul\'s".
3) SQL query for the search terms logic in BP_User_Query::prepare_user_ids_query() is:
"SELECT user_id FROM wp_bp_xprofile_data WHERE value LIKE '%%paul

(that's three backslashes in the above -- Trac is eating some)

Compare against how WP stores database data in post title and content; "Paul's" is literally stored as "Paul's", which is what #2776 is about.

Last edited 4 years ago by DJPaul (previous) (diff)

#2 @DJPaul
4 years ago

  • Milestone changed from Awaiting Review to Future Release
  • Version changed from 1.6.1 to 1.0
Note: See TracTickets for help on using tickets.