PDA

View Full Version : [PMs] Username Finder


Daniel
11-19-2014, 08:22 PM
Hey all,

So we know that by default, when we begin typing in a username in the Private Message system the system will pull up a list of the usernames we might be trying to send to.

e.g. I'm typing "Dani" and the username "Daniel" is displayed in a pop-up box.

https://vborg.vbsupport.ru/external/2014/11/16.png

Is there a way to change this, so that when I type in "Dani" the usernames pulled up would also include usernames like "Ladani" or "Ladanioso"

If you have any guidance or code know-how, please don't hesitate to share. It's all much appreciated! Thank you!

Dave
11-19-2014, 08:27 PM
ajax.php, around line 128 to 133 you have this:

$users = $db->query_read_slave("
SELECT user.userid, user.username FROM " . TABLE_PREFIX . "user
AS user WHERE username LIKE('" . $db->escape_string_like($fragment) . "%')
ORDER BY username
LIMIT 15
");

Modify it to this:
$users = $db->query_read_slave("
SELECT user.userid, user.username FROM " . TABLE_PREFIX . "user
AS user WHERE username LIKE('%" . $db->escape_string_like($fragment) . "%')
ORDER BY username
LIMIT 15
");

Daniel
11-19-2014, 08:50 PM
Works like a charm. Thanks a million Dave.