Skip to content

Commit

Permalink
Merge pull request #66 from pkp/i4601-fix-stable-3_1_2
Browse files Browse the repository at this point in the history
pkp/pkp-lib#4601 Work-around for missing user object access in OJS 3.1.2
  • Loading branch information
asmecher authored Mar 21, 2019
2 parents 63f1ed2 + c22fb3e commit b6e43fd
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 b6e43fd

Please sign in to comment.