From b0d79005308c30a6db2878377107643e77f0c03f Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Wed, 3 Nov 2010 12:53:51 -0700 Subject: [PATCH] Add getFancyName() to User_group to match the one on Profile: encapsulates the "fullname (nickname)" vs "nickname" logic and allows for localization of the parentheses in a common place. --- classes/User_group.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/classes/User_group.php b/classes/User_group.php index 7d6e219148..60217e960e 100644 --- a/classes/User_group.php +++ b/classes/User_group.php @@ -234,6 +234,22 @@ class User_group extends Memcached_DataObject 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(_m('FANCYNAME','%1$s (%2$s)'), $this->fullname, $this->nickname); + } else { + return $this->nickname; + } + } + function getAliases() { $aliases = array(); -- 2.39.5