Any NON Latin phpBB username (any language), will be added as transliterated in Latin into WordPress, by default.
If the 'transliterator_transliterate' function is not available, because it is not configured in PHP (but it commonly is) then the NON Latin username will probably not be correctly processed by WordPress and the user transfer will fail (user not transferred/created in WP). In this case, an array of languages/chars could be provided to workaround the lacking of the 'transliterator_transliterate' Php native function, but by default the code will not provide it. Anyway as said, the 'transliterator_transliterate' function is commonly available into any Php.
To add phpBB users in WordPress using native characters of phpBB usernames:
add this into the wp-config.php file
Code: Select all
define( 'WPW3ALL_USE_UNAME_NATIVE_LANG_CHARS', 1 );
Code: Select all
/* Add any custom values between this line and the "stop editing" line. */
Once it has been added into the wp-config.php file, the username will be transferred/added into WordPress with his (same) username like it is into phpBB, but purged as explained more below.
*NOTE: worth also to mention that, into my tests, and even using a default WordPress setting it let say as Cyrillic as example, after that an user has been added with Cyrillic chars, when the user go to update his profile, WordPress answer with an error about failed user addition (that happen into a default wordpress and not due to the plugin integration code that during tests have been also disabled), and there is no way to update the user's profile into WP, answer by WordPress is:
My question (that i have not investigate) is:Cannot create a user with an empty login name.
what it do a WordPress configured in a non Latin language when usernames are not into Latin and how it is managed?
The code should work fine into any "modified" (??) WordPress that allow to manage native non Latin usernames into WordPress (if it is the way that it is done, or some other).
Any characters/languages for usernames: how it work
Code: Select all
define( 'WPW3ALL_USE_UNAME_NATIVE_LANG_CHARS', 1 );
Code: Select all
Arabic,Armenian,Bengali,Bopomofo,Braille,Buhid,Canadian_Aboriginal,Cherokee,Cyrillic,Devanagari,Ethiopic,Georgian,Greek,Gujarati,Gurmukhi,Han,Hangul,Hanunoo,Hebrew,Hiragana,Inherited,Kannada,Katakana,Khmer,Lao,Latin,Limbu,Malayalam,Mongolian,Myanmar,Ogham,Oriya,Runic,Sinhala,Syriac,Tagalog,Tagbanwa,TaiLe,Tamil,Telugu,Thaana,Thai,Tibetan,Yi
If
Code: Select all
define('WPW3ALL_USE_DEFAULT_WP_UCHARS', 1);
Code: Select all
-0-9A-Za-z _.@
Code: Select all
0-9A-Za-z
Code: Select all
define( 'WPW3ALL_USE_UNAME_NATIVE_LANG_CHARS', 1 );
The correct cleanup of the username by unwanted characters in any native language is performed using regular expressions.
The new added and used function that allow this, will reside into:
/wp-content/plugins/wp-w3all-phpbb-integration/common/helpers.php
It will start looking definitively like this:
Code: Select all
# function w3all_detectClean_language_chars
# Detect any text language
##$test = w3all_detectClean_language_chars($text, false, false, true);
// and return one of these
// Arabic,Armenian,Bengali,Bopomofo,Braille,Buhid,Canadian_Aboriginal,Cherokee,Cyrillic,Devanagari,Ethiopic,Georgian,Greek,Gujarati,Gurmukhi,Han,Hangul,Hanunoo,Hebrew,Hiragana,Inherited,Kannada,Katakana,Khmer,Lao,Latin,Limbu,Malayalam,Mongolian,Myanmar,Ogham,Oriya,Runic,Sinhala,Syriac,Tagalog,Tagbanwa,TaiLe,Tamil,Telugu,Thaana,Thai,Tibetan,Yi
# return sanitized text for -> MUMS that allow only '[0-9A-Za-z]'
##$test = w3all_detectClean_language_chars($text, true);
# return sanitized text for -> default WP '[-0-9A-Za-z _.@]'
##$test = w3all_detectClean_language_chars($text, false, false, false);
# return text transliterated to Latin text
##$test = w3all_detectClean_language_chars($text, false, true);
function w3all_detectClean_language_chars($text, $return_x_mums = false, $returnLatin = false, $returnDetectLang = false)
{
...
...