by axew3 » Sat Sep 14, 2024 7:12 pm
Note: plugin version 2.9.0 >
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 );
after the line
Code: Select all
/* Add any custom values between this line and the "stop editing" line. */
now for example the Cyrillic username
двойняшки will be transferred/created into WP as
двойняшки (Cyrillic)
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:
Cannot create a user with an empty login name.
My question (that i have not investigate) is:
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 );
Considered alphabets are
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
The integration code by default, if no option via DEFINE into the
wp-config.php as been set, will add phpBB usernames that are not Latin into WordPress, transliterated to Latin.
If
Code: Select all
define('WPW3ALL_USE_DEFAULT_WP_UCHARS', 1);
option is set, usernames into WordPress will be added as sanitized allowing these chars also into a WP MUMS multisite:
if not and if WP is MUMS, the username will added after that it has been purged from unwanted characters, so allowing only letters and numbers:
if
Code: Select all
define( 'WPW3ALL_USE_UNAME_NATIVE_LANG_CHARS', 1 );
is set, usernames are added into WordPress using the native language, after that it has been sanitized by unwanted characters (exactly like the Latin) like above mentioned.
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)
{
...
...
[size=200][b]Note:[/b] plugin version 2.9.0 >[/size]
[size=200][color=#BF0040][b]Any NON Latin phpBB username[/b][/color][/size] (any language), will be added as transliterated in [b]Latin[/b] into WordPress, by default.
If the [b]'transliterator_transliterate'[/b] 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 [b]'transliterator_transliterate'[/b] function is commonly available into any Php.
[b][size=150][color=#BF0040]
To add phpBB users in WordPress using native characters of phpBB usernames:[/color][/size][/b]
[size=120]add this into the [b]wp-config.php[/b] file[/size]
[code]define( 'WPW3ALL_USE_UNAME_NATIVE_LANG_CHARS', 1 );[/code]
after the line
[code]/* Add any custom values between this line and the "stop editing" line. */[/code]
now for example the Cyrillic username [b]двойняшки[/b] will be transferred/created into WP as [b]двойняшки[/b] (Cyrillic)
Once it has been added into the [b]wp-config.php[/b] file, the username will be transferred/added into WordPress with his (same) username like it is into phpBB, but purged as explained more below.
[size=150]*NOTE: worth also to mention that[/size], 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:
[quote]Cannot create a user with an empty login name.[/quote]
[b]My question[/b] (that i have not investigate) is:
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).
[size=200][color=#BF0040]Any characters/languages for usernames:[/color] how it work[/size]
[code]define( 'WPW3ALL_USE_UNAME_NATIVE_LANG_CHARS', 1 );[/code]
Considered alphabets are
[code]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
[/code]
The integration code by default, if no option via DEFINE into the [b]wp-config.php[/b] as been set, will add phpBB usernames that are not Latin into WordPress, transliterated to Latin.
If
[code]define('WPW3ALL_USE_DEFAULT_WP_UCHARS', 1);[/code]
option is set, usernames into WordPress will be added as sanitized allowing these chars also into a WP MUMS multisite:
[code]-0-9A-Za-z _.@[/code]
if not and if WP is MUMS, the username will added after that it has been purged from unwanted characters, so allowing only letters and numbers:
[code]0-9A-Za-z [/code]
if
[code]define( 'WPW3ALL_USE_UNAME_NATIVE_LANG_CHARS', 1 );[/code]
is set, usernames are added into WordPress using the native language, after that it has been sanitized by unwanted characters (exactly like the Latin) like above mentioned.
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:
[i]/wp-content/plugins/wp-w3all-phpbb-integration/common/[b]helpers.php[/b][/i]
It will start looking definitively like this:
[code]# 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)
{
...
...
[/code]