Opened 12 years ago
Closed 8 years ago
#4704 closed defect (bug) (worksforme)
Member search on string containing apostrophe returns no results.
Reported by: | kevingamin | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | major | Version: | 1.0 |
Component: | Members | Keywords: | |
Cc: |
Description
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 (3)
Note: See
TracTickets for help on using
tickets.
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
\'s%%'"
(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 "Paul\'s", which is what #2776 is about.