PDA

View Full Version : add Arabic characters in USERNAME



Mohammed Elbadawi
April 10, 2018, 09:59 AM
Hello

I am trying to add Arabic characters in USERNAME
the USERNAME field only support Latin characters
I don't know PHP

You need two places

rlAccount -> function ajaxUserExist

rlAccount -> function validateUsername

There is regular expression that need to be modified, or checking condition can be totally skipped.

can someone help me THANKS

Rudi
April 11, 2018, 05:51 AM
Hello,

As you may know, usernames are not used in Arabic by all systems because it can cause unexpected errors saving Arabic username to database

so we also recommend against using it

but if you still need to use Arabic username you should disable username verification (which is not good) because it blocks Arabic symbols

disable validateUsername function

Mohammed Elbadawi
April 11, 2018, 08:10 AM
Hi Rudi

in my website when ppl sing up using facebook the USERNAME show in Arabic
I have multiple USERNAME in Arabic
I am trying to test it in my test website so how can I disable validateUsername function

THANKS

Rudi
April 11, 2018, 09:54 AM
go to ftp > includes > controllers > registration.inc.php > find a comment // username login mode

change a code below from:


if (!$rlAccount->validateUsername($username)) {
$errors[] = str_replace('{field}', '<span class="field_error">"' . $lang['username'] . '"</span>', $lang['notice_field_not_valid']);
$error_fields = 'profile[username],';
} else {
$rlValid->sql($username);
if ($rlDb->getOne('ID', "`Username` = '{$username}'", 'accounts')) {
$errors[] = str_replace('{username}', $username, $lang['notice_account_exist']);
$error_fields = 'profile[username]';
}
}


to:


$rlValid->sql($username);
if ($rlDb->getOne('ID', "`Username` = '{$username}'", 'accounts')) {
$errors[] = str_replace('{username}', $username, $lang['notice_account_exist']);
$error_fields = 'profile[username]';
}



then go to includes > classes > rlAccount.class.php > function ajaxUserExist

change:


if ( $exist || empty($username)
|| (!$valid && $message = str_replace('{field}', '<span class="field_error">"'.$lang['username'].'"</span>', $lang['notice_field_not_valid']))
)


to:


if ( $exist || empty($username) )

Mohammed Elbadawi
April 11, 2018, 09:26 PM
Hi

after I edited the registration.inc.php the USERNAME work with Arabic without problem
but I did not find the rlAccount.inc.php in classes folder I only find rlActions.class.php and it dos not have the code

Viktor
April 12, 2018, 03:09 AM
Hello Mohammed,

I have opened your ftp and found this file. See my attached screenshot: https://prnt.sc/j43m75