Add sort_name to pluser.
[platal.git] / classes / pluser.php
index 5765655..c974b7e 100644 (file)
@@ -82,6 +82,7 @@ abstract class PlUser implements PlUserInterface
     // <display name> !"), while full name is the official full name.
     protected $display_name = null;
     protected $full_name = null;
+    protected $sort_name = null;
 
     // Other important parameters used when sending emails.
     protected $gender = null;  // Acceptable values are GENDER_MALE and GENDER_FEMALE
@@ -367,7 +368,7 @@ abstract class PlUser implements PlUserInterface
                     $list[$i] = $login;
                 }
             }
-            return $list;
+            return array_unique($list);
         }
         return null;
     }
@@ -403,7 +404,7 @@ abstract class PlUser implements PlUserInterface
 
     private static function stripBadChars($text)
     {
-        return str_replace(array(' ', "'"), array('-', ''),
+        return str_replace(array(' ', "'", '+'), array('-', '', '_'),
                            strtolower(stripslashes(replace_accent(trim($text)))));
     }
 
@@ -426,7 +427,7 @@ abstract class PlUser implements PlUserInterface
     public static function makeHrid($firstname, $lastname, $category)
     {
         $cat = self::stripBadChars($category);
-        if (!cat) {
+        if (!$cat) {
             Platal::page()->kill("$category is not a suitable category.");
         }
 
@@ -454,5 +455,5 @@ abstract class PlUser implements PlUserInterface
     }
 }
 
-// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8:
+// vim:set et sw=4 sts=4 sws=4 foldmethod=marker fenc=utf-8:
 ?>