From: Brion Vibber Date: Wed, 3 Nov 2010 19:53:51 +0000 (-0700) Subject: Add getFancyName() to User_group to match the one on Profile: encapsulates the "fulln... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b0d79005308c30a6db2878377107643e77f0c03f;p=quix0rs-gnu-social.git 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. --- 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();