summaryrefslogtreecommitdiff
path: root/classes/Profile.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/Profile.php')
-rw-r--r--classes/Profile.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/classes/Profile.php b/classes/Profile.php
index e05b8bf27..43475884b 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -141,12 +141,33 @@ 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.
*
* @return mixed Notice or null