From 51dca582cd2cda9416ec0172f8ed9a19ba828fec Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 19 Jul 2009 16:50:35 -0700 Subject: More thorough fix for #421. Create User_Model::display_name() which uses the full name if there is one, or falls back to the name if that's all we have. --- modules/user/models/user.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'modules/user/models') diff --git a/modules/user/models/user.php b/modules/user/models/user.php index 0234f186..def65a6f 100644 --- a/modules/user/models/user.php +++ b/modules/user/models/user.php @@ -72,4 +72,13 @@ class User_Model extends ORM { } return $this; } + + /** + * Return the best version of the user's name. Either their specified full name, or fall back + * to the user name. + * @return string + */ + public function display_name() { + return empty($this->full_name) ? $this->name : $this->full_name; + } } \ No newline at end of file -- cgit v1.2.3