From 426cda5e1ffd365b6b8915e8d504c0a6672339d3 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 2 Nov 2010 13:42:33 -0700 Subject: Alternate pretty-title tweaks for #2668 --- classes/Profile.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'classes/Profile.php') diff --git a/classes/Profile.php b/classes/Profile.php index 37d2c571f..064ba551c 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -141,11 +141,32 @@ class Profile extends Memcached_DataObject return true; } + /** + * Gets either the full name (if filled) or the nickname. + * + * @return string + */ function getBestName() { return ($this->fullname) ? $this->fullname : $this->nickname; } + /** + * Gets the full name (if filled) with nickname as a parenthetical, or the nickname alone + * if no fullname is provided. + * + * @return string + */ + function getFancyName() + { + if ($this->fullname) { + // TRANS: Full name of a profile or group followed by nickname in parens + return sprintf(_('%1$s (%2$s)'), $this->fullname, $this->nickname); + } else { + return $this->nickname; + } + } + /** * Get the most recent notice posted by this user, if any. * -- cgit v1.2.3-54-g00ecf