In user_import.module v1.17.2.4, function _user_import_sanitise_username() strips out periods, hyphens and underscores but these are explicitly allowed in the 5.x user registration (username field description says "Your preferred username; punctuation is not allowed except for periods, hyphens, and underscores."). I made the following change to allow usernames with periods:

--- modules/user_import/user_import.module      (revision 4864)
+++ modules/user_import/user_import.module      (working copy)
@@ -1171,7 +1171,7 @@
     if ($sanitised == 0) {
   
         // username cannot contain an illegal character
-        $username = preg_replace('/[^a-zA-Z0-9@ ]/', ' ', $username);
+        $username = preg_replace('/[^a-zA-Z0-9@ \.\-_]/', ' ', $username);
         // username cannot contain multiple spaces in a row
         $username = preg_replace('/[ ]+/', ' ', $username);   

Comments

mfb’s picture

Status: Active » Closed (duplicate)