Skip to:

Opened 10 years ago

Closed 10 years ago

#5769 closed enhancement (fixed)

Configurable wildcard search types in BP_User_Query

Reported by: djpaul's profile DJPaul Owned by: djpaul's profile djpaul
Milestone: 2.1 Priority: normal
Severity: normal Version:
Component: Core Keywords: has-patch commit


For #3278, I need to be able to set the wildcards used around the search_terms argument in BP_User_Query.

Right now, we add % to both sides of the search term. For auto-suggestions, I need to be able to do a member search in BP_User_Query but only allowing the wildcard on the right-hand side of the search string, e.g. `hello%' instead of '%hello%'.

Attached patch adds a new search_wildcard argument to BP_User_Query, with a unit test.

Attachments (1)

5769.01.patch (4.6 KB) - added by DJPaul 10 years ago.

Download all attachments as: .zip

Change History (4)

10 years ago

#1 @DJPaul
10 years ago

I'm reasonably happy with this approach, but wanted opinions from other devs, particularly Boone, before going ahead.

#2 @boonebgorges
10 years ago

  • Keywords commit added; dev-feedback removed

This approach looks pretty good to me. Thanks, DJPaul.

#3 @djpaul
10 years ago

  • Owner set to djpaul
  • Resolution set to fixed
  • Status changed from new to closed

In 8675:

Core: add new search_wildcard parameter to BP_User_Query.

This new parameter controls where BuddyPress places MySQL wildcard characters around the search term (when it's set).
Prior to this change, BuddyPress added a wildcard character to both ends of the search term, but for some use cases, a more restrictive search pattern is required; you can specify "left", "right", or "both" (the default) to pick where the wildcard is added.

Fixes #5769

Note: See TracTickets for help on using tickets.