Hello,

There is a small issue when searching for a username in autocomplete.
Only usernames that are starting with the keyword are returned.

Here's is a patch that will return usernames that contains the keyword.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Ludo.R’s picture

Title: Search automcomplete » Search autocomplete
Ludo.R’s picture

Title: Search autocomplete » Username search autocomplete
Ludo.R’s picture

FileSize
747 bytes

Sorry,

Previous patch doesn't work as expected.
Try this one instead :

andypost’s picture

Version: 6.x-1.7 » 6.x-1.x-dev
Status: Active » Needs review

Your patch changes search to starting with... as for me this makes no sense because this regression from current functionaly.

Ludo.R’s picture

I'm not sure to understand what you say.

This patch allows searching usernames that contain the keyword rather than starting with the keyword.

Let's say we have a john.smith username.

Before, if I typed smith, I found nothing.
With this patch, you would find john.smith.

andypost’s picture

Status: Needs review » Needs work
+++ b\masquerade.module
@@ -555,7 +555,7 @@
-  $result = db_query_range("SELECT u.name FROM {users} u WHERE LOWER(u.name) LIKE LOWER('%%%s%%')", $string, 0, 10);
+  $result = db_query_range("SELECT u.name FROM {users} u WHERE LOWER(u.name) LIKE LOWER('%s%%')", $string, 0, 10);

but your batch suggests %s%% whick means starting with

Ludo.R’s picture

FileSize
747 bytes

Oh, sorry, my mistake.
I inverted the two files.

Here it is :

andypost’s picture

Title: Username search autocomplete » Change Username search autocomplete to - contains string
Status: Needs work » Needs review

Re-titled and makes sense so let's get more reviews

andypost’s picture

Category: bug » feature

this change should be ported to 7.x first and require review of other mainteiners

deekayen’s picture

Status: Needs review » Needs work

I'll commit stuff that for 7 with no 6 patch, but not the other way around.

apaderno’s picture

Issue summary: View changes
Status: Needs work » Closed (outdated)

I am closing this feature request, as Drupal 6 is no longer supported. Please re-open it if you would like the feature implemented in the Drupal 7 or 8 version of the module.