diff --git a/classes/identity/Identity.inc.php b/classes/identity/Identity.inc.php index ab31a0c9cef..bc4fd7d70fc 100644 --- a/classes/identity/Identity.inc.php +++ b/classes/identity/Identity.inc.php @@ -69,17 +69,21 @@ function &getLocalizedData($key, $preferredLocale = null) { * @param $defaultLocale string * @return string */ - function getFullName($preferred = true, $familyFirst = false, $defaultLocale = null) { - $locale = $defaultLocale ?? AppLocale::getLocale(); + function getFullName($preferred = true, $familyFirst = false, $defaultLocale = null, $preferredLocale = null) { + $locale = $preferredLocale ?? AppLocale::getLocale(); if ($preferred) { $preferredPublicName = $this->getPreferredPublicName($locale); if (!empty($preferredPublicName)) return $preferredPublicName; } $givenName = $this->getGivenName($locale); if (empty($givenName)) { - // Fallback to the site's primary locale if no given name - // exists in the requested locale - $locale = Application::get()->getRequest()->getSite()->getPrimaryLocale(); + if (is_null($defaultLocale)) { + // the users register for the site, thus + // the site primary locale is the default locale + $site = Application::get()->getRequest()->getSite(); + $defaultLocale = $site->getPrimaryLocale(); + } + $locale = $defaultLocale; $givenName = $this->getGivenName($locale); } $familyName = $this->getFamilyName($locale); diff --git a/classes/submission/PKPAuthor.inc.php b/classes/submission/PKPAuthor.inc.php index dac367b07a4..5e3fd3a1e1c 100644 --- a/classes/submission/PKPAuthor.inc.php +++ b/classes/submission/PKPAuthor.inc.php @@ -77,9 +77,9 @@ function getLocalizedFamilyName() { /** * @copydoc Identity::getFullName() */ - function getFullName($preferred = true, $familyFirst = false, $defaultLocale = null) { + function getFullName($preferred = true, $familyFirst = false, $defaultLocale = null, $preferredLocale = null) { if (!isset($defaultLocale)) $defaultLocale = $this->getSubmissionLocale(); - return parent::getFullName($preferred, $familyFirst, $defaultLocale); + return parent::getFullName($preferred, $familyFirst, $defaultLocale, $preferredLocale); } //