Skip to content
Snippets Groups Projects
Commit 9a19c0af authored by Björn Schießle's avatar Björn Schießle
Browse files

search for display name and uid (with no display name) since it is possible...

search for display name and uid (with no display name) since it is possible that not all users have a seperate display name
parent 00a30e66
Branches
No related tags found
No related merge requests found
......@@ -158,10 +158,20 @@ class OC_User_Database extends OC_User_Backend {
$query = OC_DB::prepare('SELECT `uid`, `displayname` FROM `*PREFIX*users` WHERE LOWER(`displayname`) LIKE LOWER(?)', $limit, $offset);
$result = $query->execute(array($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'], ' ');
$displayNames[$row['uid']] = empty($displayName) ? $row['uid'] : $displayName;
if ( empty($displayName) )
$displayNames[$row['uid']] = $row['uid'];
}
return $displayNames;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment