Hi,
we have observed on several OJS 3.5 instances that the ORCID request email to co-authors (ORCID_COLLECT_AUTHOR_ID) is sometimes sent in a wrong language, or does not arrive at all – for example, in our case in Arabic, even though our journal uses German.
The error occurred after we started sending emails via the scheduler/cronjob (using lib/pkp/tools/scheduler.php), meaning the process was no longer triggered directly via a browser request.
When executed via cronjob, OJS no longer correctly identifies the current journal, because there is no web address from which the journal can be derived. OJS should then fall back to the journal’s default language, but in this specific case this does not happen. Instead, it simply takes some randomly available language version of the email text (or the alphabetically first one from email_template_settings).
When debugging lib/pkp/classes/mail/Mailer.php
[…]
public function send($view, array $data = , $callback = null)
{
if (is_a($view, Mailable::class)) {
/** @var Mailable $view */
error_log(‘DEBUG ORCID: Mailable class=’ . get_class($view) . ’ resolved locale=’ . $view->getLocale());
$view->setData($view->getLocale());
}
[…]
you can see that the locale is empty.
Workaround we implemented locally:
In lib/pkp/jobs/orcid/SendAuthorMail.php, the language is not explicitly set when sending the email. We changed this so that the journal’s language is explicitly passed instead of relying on the (non-functional in cronjobs) automatic detection. Since then, the email reliably arrives in the correct primary language.
Has anyone else observed this, or is there an official fix for it? For us, it is currently a small custom patch that has to be reapplied with every upgrade.
Additional issue we noticed:
If the journal’s contact email address does not correspond to a registered user account (e.g. a pure functional address like redaktion@...), this ORCID email sending fails completely with the error:
Error: Call to a member function getLocalizedSignature() on null in /srv/www/ojs03/htdocs/lib/pkp/classes/mail/traits/OrcidVariables.php:60
Our workaround: Create a user account with exactly this email address.