Excellent question.
I would like to accomplish the same thing. I've got vB3 running on a site with several apps that share it's user database for login (e.g. sigmachat). But most of my apps do NOT allow spaces in their usernames. So it'd be very convenient to have vB3 block the inclusion of those characters in the username during registration.
After doing a bit of research in register.php, I discovered it already calls a function named "strip_blank_ascii" which checks a vboption (blankasciistrip) in the vb3_settings table to decide whether vB3 should automatically remove spaces from usernames during registration:
Quote:
From register.php:
// strip 'blank' ascii chars if admin wants to do so
$_POST['username'] = strip_blank_ascii($_POST['username'], ' ');
|
and
Quote:
From functions.php:
// ################ Start blankAsciiStrip #################
// note: blank removal currently causes problems with double byte languages!
function strip_blank_ascii($text, $replace)
{
global $vboptions;
if (trim($vboptions['blankasciistrip']) != '')
{
etc. and so on and so forth...
}
return $text;
}
|
The truth is rather than just have vB3 quietly remove spaces from the username, I'd prefer to have it tell the user they're "not allowed" in the username and ask the user to remove them.
Checking further, I see Scott McVicar provided a similar hack here a couple of years ago that was designed to block special characters in usernames in vB2:
https://vborg.vbsupport.ru/showthrea...paces+username
So the question is can Scott (or someone else) provide a similar "no special characters" hack for vb3's register.php today?
Thanks!
WebSissy