summaryrefslogtreecommitdiffstats
path: root/lib/user/database.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/user/database.php')
-rw-r--r--lib/user/database.php20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/user/database.php b/lib/user/database.php
index 7deeb0c4697..a9ec7b1bfe8 100644
--- a/lib/user/database.php
+++ b/lib/user/database.php
@@ -156,12 +156,22 @@ 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.'%'));
+ $result = $query->execute(array($search.'%'));
$users = array();
- while ($row = $result->fetchRow()) {
- $displayName = trim($row['displayname'], ' ');
- $displayNames[$row['uid']] = empty($displayName) ? $row['uid'] : $displayName;
- }
+ 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;
}