**in /library/core/functions.validation.php**
try to find this
'/^([\d\w_]{3,20})?$/si'
and replace it with this or whatever is needed :
'/^([\p{L}\p{N}\p{Pd}\p{Pc}\p{Lm}\p{M}]{3,20}+)?$/'
in this function below
Redefine ValidateUsername() function
if (!function_exists('ValidateUsername')) {
function ValidateUsername($Value, $Field = '') {
if (preg_match('/(^[ ]|[ ]{2}|[ ]$)/', $Value)) return FALSE; // JDJ Fail on leading, trailing or runs of spaces
return ValidateRegex(
$Value,
'/^([\d\w_ ]{3,40})?$/si' // JDJ Allow spaces and 40 char length
);
}
}
**Changing the Regex filter from ascii-only to Unicode,which will allow you to use any kind of letters from any language..**
you can also customize your filter to allow or disallow specific characters by adding or removing Unicode components (the "p{x}" components within the Regex filter). Here is a small list of what each of those components mean:
\p{L}: any kind of letter from any language.
\p{Lm}: a special character that is used like a letter.
\p{M}: a character intended to be combined with another character (e.g. accents, umlauts, enclosing boxes, etc.).
\p{N}: any kind of numeric character in any script.
\p{Z}: any kind of whitespace or invisible separator.
\p{Pd} or \p{Dash_Punctuation}: any kind of hyphen or dash.
\p{Pc}: a punctuation character such as an underscore that connects words.
for a complete list of Unicode components, refer to this url:
http://www.regular-expressions.info/unicode.html
An aside: @vrijvlinder remember you can redefine all functions that have an include guard. In this case, you could place your modified ValidateUsername function in your /conf/bootstrap.before.php file to swap out the function for your modified one without hacking the core.
To expand, you can do this for any function that is included right after an if(!function_exists('NameToOverride')) { block.
@hgtonight said:
An aside: vrijvlinder remember you can redefine all functions that have an include guard. In this case, you could place your modified ValidateUsername function in your /conf/bootstrap.before.php file to swap out the function for your modified one without hacking the core.
Ah ! here is another idea for a plugin to avoid hacking the core no? I like the config solution, less hassle for sure.
Comments
Have you tried?
What version of Vanilla are you running?
From a cursory look at the
GDN_User
table in 2.0.18.8, it appears that the name field is set as 'utf8_unicode_ci' which should support Kanji.Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
I think they must change the code in the registration verification from ASCII to unicode.
http://vanillaforums.org/discussion/23312/wrong-error-with-member-registration#latest
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
Good catch @vrijvlinder. What I meant to say is that the underlying software supports it.
I would add a user manually (through phpmyadmin or the like) using a Kanji name and see if anything barks at you.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
I am using 2.0.18.4 and not working for me
I will try the latest ones
After update I still get this error while registrating with kanji
You would be better off changing this
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
I have no way to test inputting Kanji characters, but this should theoretically work. Place the following in your
/conf/config.php
file.Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
An aside: @vrijvlinder remember you can redefine all functions that have an include guard. In this case, you could place your modified
ValidateUsername
function in your/conf/bootstrap.before.php
file to swap out the function for your modified one without hacking the core.To expand, you can do this for any function that is included right after an
if(!function_exists('NameToOverride')) {
block.Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
wow it works now @hgtonight
thanks for the simple easy answers
Ah ! here is another idea for a plugin to avoid hacking the core no? I like the config solution, less hassle for sure.
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
@altious I never would have found it if not for @vrijvlinder's persistence into looking into it.
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.