diff options
author | Björn Schießle <schiessle@owncloud.com> | 2013-01-28 15:47:57 +0100 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2013-01-28 15:47:57 +0100 |
commit | c00b66fe5bb37403e4dec1ede9d509947b795df0 (patch) | |
tree | 5862b29d772e719116c4fb665231a1fd4e3127d5 /lib/user/database.php | |
parent | e6cc0cd08a502fc426c868bd1981c80eb39a9062 (diff) | |
download | nextcloud-server-c00b66fe5bb37403e4dec1ede9d509947b795df0.tar.gz nextcloud-server-c00b66fe5bb37403e4dec1ede9d509947b795df0.zip |
implement DisplayNamesInGroup for database back-end
Diffstat (limited to 'lib/user/database.php')
-rw-r--r-- | lib/user/database.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/user/database.php b/lib/user/database.php index 52f11a5e29d..bed97f25fdb 100644 --- a/lib/user/database.php +++ b/lib/user/database.php @@ -138,8 +138,9 @@ class OC_User_Database extends OC_User_Backend { if( $this->userExists($uid) ) { $query = OC_DB::prepare( 'SELECT displayname FROM `*PREFIX*users` WHERE `uid` = ?' ); $result = $query->execute( array( $uid ))->fetchAll(); - if (!empty($result[0]['displayname'])) { - return $result[0]['displayname']; + $displayName = trim($result[0]['displayname'], ' '); + if ( !empty($displayName) ) { + return $displayName; } else { return $uid; } @@ -157,8 +158,9 @@ class OC_User_Database extends OC_User_Backend { $query = OC_DB::prepare('SELECT `uid`, `displayname` FROM `*PREFIX*users` WHERE LOWER(`uid`) LIKE LOWER(?)', $limit, $offset);
$result = $query->execute(array($search.'%'));
$users = array();
- while ($row = $result->fetchRow()) {
- $displayNames[$row['uid']] = $row['displayname'];
+ while ($row = $result->fetchRow()) { + $displayName = trim($row['displayname'], ' ');
+ $displayNames[$row['uid']] = empty($displayName) ? $row['uid'] : $displayName;
}
return $displayNames;
} |