diff options
author | Brion Vibber <brion@pobox.com> | 2010-11-03 12:53:51 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-11-03 12:53:51 -0700 |
commit | b0d79005308c30a6db2878377107643e77f0c03f (patch) | |
tree | 1f8a4690c03fca73ec6ac19e6c72e522db180fbf | |
parent | 5592333b73d970cb9ae326880fc587b1fb8032ce (diff) |
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.
-rw-r--r-- | classes/User_group.php | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/classes/User_group.php b/classes/User_group.php index 7d6e21914..60217e960 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(); |