Normal hack caveats apply.
We're going to edit one file: register.php. Open it up, and go to lines 60-73. It should look something like this...
switch ( $xoopsConfigUser['uname_test_level'] ) {
case 0:
// strict
$restriction = '/[^a-zA-Z0-9_-]/';
break;
case 1:
// medium
$restriction = '/[^a-zA-Z0-9_-<>,.$%#@!\'"]/';
break;
case 2:
// loose
$restriction = '/[ 00- 40]/';
break;
}
The following line of code should be added BEFORE this block of code. This line will prevent people from creating new accounts which "spoof" currently-existing accounts by adding extraneous spaces. For example, without this line, someone could spoof "The [space] Administrator" by creating an account with the name "The [space] [space] Administrator." This person wouldn't really have admin powers, but they could appear to post as the admin.
$uname = preg_replace('/s+/', ' ', $uname);
Now, before the ] in the first two lines that start with $restriction, we want to add "\s", which signifies a whitespace as created by the space bar; on the third $restriction line, it needs to be "\s\". (Depending on your "strictness" setting in the User Info section of the site Preferences, you actually only have to edit the relevant line, but in order to not "break" things should you change this setting in the future, we'll do all three.) Note that \ is a BACKSLASH (the key above Return and below Delete on a Mac or above Enter and below Backspace on a PC), not a / SLASH (which shares a key with the ? question mark.) The block of code, with the line added to the beginning, should look like this...
$uname = preg_replace('/s+/', ' ', $uname);
switch ( $xoopsConfigUser['uname_test_level'] ) {
case 0:
// strict
$restriction = '/[^a-zA-Z0-9_-s]/';
break;
case 1:
// medium
$restriction = '/[^a-zA-Z0-9_-<>,.$%#@!\'"s]/';
break;
case 2:
// loose
$restriction = '/[ 00- 40s]/';
break;
}
Now there's one more thing we gotta do. Let's look at lines 90-92 (they were lines 89-91 before we added that line of code above);
if ( strrpos($uname,' ') > 0 ) {
$stop .= _US_NICKNAMENOSPACES."
";
}
We don't want these lines. You could delete them if you want, but I suggest we "comment out" the lines instead. This means we're going to signify this code as a "comment" which should be ignored. To do this, we want to put /* before the block, and */ after it. (Note we're using a / slash this time, and not a \ backslash.)
/* if ( strrpos($uname,' ') > 0 ) {
$stop .= _US_NICKNAMENOSPACES."
";
}*/
Save the file, and make a test account with a space in the username to make sure it works.
Xoops seems to work just fine with usernames with spaces... Let me know if something broke in your case.