diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2013-10-26 13:56:32 -0700 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2013-10-26 13:56:32 -0700 |
commit | 9e9b2afe50be1fdffae92efac1dfce5babae7c34 (patch) | |
tree | 924d0cfcfea42fdcbb860c29afa80344e1ec6384 | |
parent | 5fca709e943810c608ecf7f941988f82d4952630 (diff) | |
parent | 466b6c1ee0da251eb5d8ba1680a3787fce03ad34 (diff) | |
download | nextcloud-server-9e9b2afe50be1fdffae92efac1dfce5babae7c34.tar.gz nextcloud-server-9e9b2afe50be1fdffae92efac1dfce5babae7c34.zip |
Merge pull request #5561 from owncloud/fix5401
local user backend shall search for both username and displayname, fixes...
-rw-r--r-- | lib/private/user/database.php | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/lib/private/user/database.php b/lib/private/user/database.php index 9f00a022d9f..3db770f9898 100644 --- a/lib/private/user/database.php +++ b/lib/private/user/database.php @@ -156,25 +156,14 @@ class OC_User_Database extends OC_User_Backend { public function getDisplayNames($search = '', $limit = null, $offset = null) { $displayNames = array(); $query = OC_DB::prepare('SELECT `uid`, `displayname` FROM `*PREFIX*users`' - .' WHERE LOWER(`displayname`) LIKE LOWER(?)', $limit, $offset); - $result = $query->execute(array($search.'%')); + .' WHERE LOWER(`displayname`) LIKE LOWER(?) OR ' + .'LOWER(`uid`) LIKE LOWER(?)', $limit, $offset); + $result = $query->execute(array($search.'%', $search.'%')); $users = array(); while ($row = $result->fetchRow()) { $displayNames[$row['uid']] = $row['displayname']; } - // let's see if we can also find some users who don't have a display name yet - $query = OC_DB::prepare('SELECT `uid`, `displayname` FROM `*PREFIX*users`' - .' WHERE LOWER(`uid`) LIKE LOWER(?)', $limit, $offset); - $result = $query->execute(array($search.'%')); - while ($row = $result->fetchRow()) { - $displayName = trim($row['displayname'], ' '); - if ( empty($displayName) ) { - $displayNames[$row['uid']] = $row['uid']; - } - } - - return $displayNames; } |