+ private static function stripBadChars($text)
+ {
+ return str_replace(array(' ', "'", '+'), array('-', '', '_'),
+ strtolower(stripslashes(replace_accent(trim($text)))));
+ }
+
+ /** Creates a username from a first and last name
+ * @param $firstname User's firstname
+ * @param $lasttname User's lastname
+ * return STRING the corresponding username
+ */
+ public static function makeUserName($firstname, $lastname)
+ {
+ return self::stripBadChars($firstname) . '.' . self::stripBadChars($lastname);
+ }