]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/Profile.php
Merge branch '1.0.x' into schema-x
[quix0rs-gnu-social.git] / classes / Profile.php
index 23042fa43afafe77d39d03490abcb390c3602e97..545950a9ee79c0a2a4c20f040d04d08b20e3dd55 100644 (file)
@@ -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.
      *