From 658123a2328867a87da59ca660a7044d99eea22c Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sat, 16 Aug 2014 17:53:07 -0700 Subject: The fullname is displayed instead of the username if not empty --- app/Model/User.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'app/Model/User.php') diff --git a/app/Model/User.php b/app/Model/User.php index 5f6b8a3a..19ec0494 100644 --- a/app/Model/User.php +++ b/app/Model/User.php @@ -98,7 +98,17 @@ class User extends Base */ public function getList() { - return $this->db->table(self::TABLE)->asc('username')->listing('id', 'username'); + $users = $this->db->table(self::TABLE)->columns('id', 'username', 'name')->findAll(); + + $result = array(); + + foreach ($users as $user) { + $result[$user['id']] = $user['name'] ?: $user['username']; + } + + asort($result); + + return $result; } /** -- cgit v1.2.3