summaryrefslogtreecommitdiff
path: root/modules/user/user.module
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2007-01-10 08:08:44 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2007-01-10 08:08:44 +0000
commit432d6244f3b9414d0e12d702ec700babc2df30f6 (patch)
treedbadc152ea5bfebcac816ec8f4ee1577949bb8ee /modules/user/user.module
parentf4c82fa91b227d237f89fc9ee35e0519f37b908b (diff)
downloadbrdo-432d6244f3b9414d0e12d702ec700babc2df30f6.tar.gz
brdo-432d6244f3b9414d0e12d702ec700babc2df30f6.tar.bz2
#108130: Don't allow empty autocomplete searches
Diffstat (limited to 'modules/user/user.module')
-rw-r--r--modules/user/user.module8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/user/user.module b/modules/user/user.module
index f278f468c..2f9398803 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -2442,9 +2442,11 @@ function _user_forms(&$edit, $account, $category, $hook = 'form') {
*/
function user_autocomplete($string = '') {
$matches = array();
- $result = db_query_range("SELECT name FROM {users} WHERE LOWER(name) LIKE LOWER('%s%%')", $string, 0, 10);
- while ($user = db_fetch_object($result)) {
- $matches[$user->name] = check_plain($user->name);
+ if ($string) {
+ $result = db_query_range("SELECT name FROM {users} WHERE LOWER(name) LIKE LOWER('%s%%')", $string, 0, 10);
+ while ($user = db_fetch_object($result)) {
+ $matches[$user->name] = check_plain($user->name);
+ }
}
print drupal_to_js($matches);
exit();