OJS3 - ORCID iD in registration form


#1

Hi,

I’m using OJS3 and here we need ORCID iD in registration form.
I modified the file lib/pkp/templates/frontend/components/registrationForm.tpl
Added in lines 83-90

           <div class="orcid">
                   <label>
                           <span class="label">
                                   ORCID iD
                           </span>
                           <input type="text" maxlength="37" class="field text" name="orcid" value="{$orcid|escape}" id="orcid">
                   </label>
           </div>

My registration form:

But, this field is not processed when it’s submited.
Where need I modify to process this new field?

Regards,
Tarcisio Pereira


#2

RegistrationForm class is a child of a Form class, which has several hooks that you can use from a plugin. As an example for another (issue) form you can look at: https://github.com/pkp/immersion/blob/master/ImmersionThemePlugin.inc.php#L58-L60

Alongside with changes in the template (e.g., with overriding it from a plugin), this should be enough to save the data in the user_settings table. Keep in mind that this table already has orcid setting.

I would avoid any modifications of OJS core files, as an OJS upgrade can become problematic in this case.


#3

Hi @Vitaliy

If I want to change the core files. What would be the file to be able to save the ORCID ID provided at the time of registration?

Is it possible then that these resources were native to the system? A suggestion of functionality maybe?

With the registration we have today. the ORCID field is not explicit to the author.

Regards,
Tarcisio Pereira


#4

Hi @Tarcisio_Pereira

To save in the database? UserDAO class is responsible for interactions between User class and Database layer. Keep in mind that you already have orcid in the user_settings table.
So, you need to retrieve User object ($user), retrieve data from the form, then setData('orcid') on the $user , then UserDAO->updateObject($user).
On second thought, I see that User class already has updateSetting method, so, theoretically, you can use it.
All this is native to the system and can be achieved from a plugin through hooks.


#5

So, basically, all you need is to do mostly the same as here: https://github.com/pkp/immersion/blob/master/ImmersionThemePlugin.inc.php#L57-L60
but with different hooks. The part of these hooks after :: would be the same