Adding localized user identification data to Register page

Hi,
Currently, user affiliation, biography , … are saved in multiple languages in OJS; but, we also want to save localized identification data from Registration page into user_settings table (including first_name,middle_name, last_name).
I used this page in GitHub as a guide, and this is what I have done for data registry, but unfortunately these fields are not saved at all in user_settings table.
By the way, I have no problem for data retrieval if the data is saved correctly ( I manually added some filed to this table for test and it went fine).
The below code is just about FirstName. the other 2 items are the same.

in templates/user/register.tpl:
<\input type="text" id="firstName" name="firstName[{$formLocale|escape}]" value="{$firstName[$formLocale]|escape}" size="20" maxlength="40" class="textField" />

in classes/user/form/RegistrationForm.inc.php:

$user->setFirstName($this->getData('firstName'),null);

in classes/user/PKPUserDAO.inc.php:

function getLocaleFieldNames() {
            return parent::getLocaleFieldNames() + array('biography', 'signature', 'gossip', 'affiliation','firstName','middleName','lastName');
        }

function getFirstName($locale) {
            return $this->getData('firstName',$locale);
        }

function setFirstName($firstName,$locale)
    {
            return $this->setData('firstName', $firstName,$locale);
    }

This code creates an error:
Unknown column 'Array' in database ...

could you please help me overcome this problem?
I am using OJS 2.4.6
Best

Hi @alirezaaa ,

A quick guess is that you are using the firstName setting to store an array value and that’s already being used by the system expecting an string value. And as far as I understood, you didn’t remove the code in the PKPUserDAO that stores the value returned by getFirstName at the first_name column, in users table.

I also have to admit this is a really problematic thing, as far as I can see. Author disambiguation is complicated enough without multiple names for the same person, depending on the locale. Of course, you know better your requirements, just a warning. :smile:

Cheers,
Bruno

Hi @beghelli,
The problem was in PKPUserDAO .
I changed it like this:

$user->setFirstName($row['first_name'],"en_US");

$user->getFirstName("en_US"),

to keep English Locale identification data in Users table and localized data in User_Settings table! Because as you mentioned it is very troublesome not to save First_name ,… in Users table.
It works and data is saved as required.
But something funny happens; in the registration form, when I change the Form Locale and click submit, instead of reloading the page, the user gets registered.
However, I am able to edit these localized fields from Profile page.
Any ideas why this happens?

P.S: I checked and it also happened with an original version of OJS 2.4.6.
If the Registration Form is fully completed in one language, changing Form Locale will proceed in user registration instead of reloading an empty form.
Is this a bug or should I put form validators to prevent this.

Cheers

@alirezaaa,

I can’t reproduce that. Are you sure your OJS is really clean?

Cheers,
Bruno

Hi @beghelli,
This has been a bug in OJS 2.4.6. I checked and it is resolved in OJS 2.4.7.1
the problem is in templates/user/register.tpl line 49:

{form_language_chooser form="register" url=$userRegisterUrl}

which is now changed to:

{form_language_chooser form="registerForm" url=$userRegisterUrl}

I implemented the dual language for user personal information and it seems ok (until now at least!)
Cheers,