Skip to content

Commit

Permalink
pkp/pkp-lib#4601 Work-around for missing user object access in OJS 3.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed Mar 20, 2019
1 parent 63f1ed2 commit c22fb3e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion OrcidProfilePlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,17 @@ function collectUserOrcidId($hookName, $params) {
$user =& $params[1];

$form->readUserVars(array('orcid'));
$user->setOrcid($form->getData('orcid'));
$orcid = $form->getData('orcid');
$username = $form->getData('username');
$userDao = DAORegistry::getDAO('UserDAO');

// On shutdown, persist the ORCID to the new user account. (https://github.com/pkp/pkp-lib/issues/4601)
register_shutdown_function(function() use ($orcid, $username, $userDao) {
$user = $userDao->getByUsername($username);
$user->setOrcid($orcid);
$userDao->updateObject($user);
});

return false;
}

Expand Down

0 comments on commit c22fb3e

Please sign in to comment.