diff options
-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; } |