Check for duplicate ORCIDs on user registration

Hi everybody,
Logically, user ORCID should be unique, like the email field. But, currently this is not checked upon registration. Has anyone implemented this in OJS?
Any ideas on what is the best way to do it?
I am using OJS 2.4.6.

Best,
Alireza

Hi @alirezaaa,

I’m not aware of anyone who has done this. You’d need to add a new validator to classes/user/form/RegistrationForm.inc.php, and you may also need to add a new database operation to fetch a user by setting e.g. in UserDAO or its parent class, PKPUserDAO.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher,
I figured it out. For those who need it:

1- add this code to validation section in RegistrationForm.inc.php and ProfileForm.inc.php

$this->addCheck(new FormValidatorCustom($this, 'orcid', 'required', 'user.register.form.orcidExists', array(DAORegistry::getDAO('UserDAO'), 'userExistsByORCID'), array(), true));

2- add this function to PKPUserDAO.inc.php

function userExistsByORCID($orcid) {
    $result =& $this->retrieve( 'SELECT COUNT(*) FROM user_settings WHERE setting_name = \'orcid\' and setting_value = ?',$orcid);
    $returner = isset($result->fields[0]) && $result->fields[0] == 1 ? true : false;
    $result->Close();
    unset($result);
    return $returner;
}

3- add a locale value for user.register.form.orcidExists in locale.xml

1 Like

This is a very important point. It will be great if the manegment system autamatically uses ORCIDs (when available - I think it should become compulsary!) to determine if somoeone is already a registered user.

Email addresses change with time.