MyBB Community Forums

Full Version: Search on partial username
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm confused about the search option for the case that you search for a user and do not know the start of the username. Take me for instance, suppose you know my last name (Bakker) but not my first name (Ad). When I type Bakker a name Bakkerad appears, but when you choose that there are no search results.

Searching solely on Bakker seems to be impossible as it only accepts suggestions that are made during typing, also when you uncheck the checkbox "match exact username".

Am I doing something wrong, or is this a shortcoming. I am in the process of learning people how the forum works, but when I ddo not understand it myself....... Huh
You mean the suggestion list, not the search itself.
If I type "bakker", the suggestion gives "bakker" and "BakkerAd", but if you select "bakker" and then submit the search form, you obtain the list of all members with "bakker" in their name.

You can modify the way it works in xmlhttp.php, line 226:
$query = $db->simple_select("users", "uid, username", "username LIKE '".$db->escape_string_like($mybb->input['query'])."%'", $query_options);

Must become:
$query = $db->simple_select("users", "uid, username", "username LIKE '%".$db->escape_string_like($mybb->input['query'])."%'", $query_options);
(2015-03-05, 03:00 PM)Crazycat Wrote: [ -> ]If I type "bakker", the suggestion gives "bakker" and "BakkerAd", but if you select "bakker" and then submit the search form

That's strange, I get this on this forum and mine:

[attachment=33913]

I cannot choose bakker, so I don't find the names with bakker in it.

But I tried your suggestion, and that works perfect. The suggestions are then all the names with bakker in it.

Thanks, I can explain this Big Grin .