Issues with User Role Invitation - OJS 3.5

I am facing issues with user invitation on 2 different OJS 3.5 installations, but in the same file lib/pkp/classes/invitation/invitations/userRoleAssignment/helpers/UserGroupHelper.php and similar errors (formatDate).

Both installations are running on WHM/cPanel environment.

Issue 1: Invitation not sent

  • PHP version: 8.3

When I click on “Invite user to the role” button, after providing the user’s email, selecting the new role, and setting the start date, the following error is shown on the screen:

PKP\invitation\invitations\userRoleAssignment\helpers\UserGroupHelper::formatDate(): Argument #1 ($timestamp) must be of type string, null given, called in /lib/pkp/classes/invitation/invitations/userRoleAssignment/helpers/UserGroupHelper.php on line 43
  • UserGroupHelper.php line 43: self::formatDate($data['dateStart']),

Full function:

    public static function fromArray(array $data): self
    {
        return new self(
            $data['userGroupId'],
            $data['masthead'],
            self::formatDate($data['dateStart']),
            $data['dateEnd'] ? self::formatDate($data['dateEnd']) : null
        );
    }

On invitation form, there is no option for select an end date for the role, so this field is always empty (null).

Because of this error, I cannot change users’ roles.


Issue 2: New role does not record after user acceptation

  • PHP version 8.2

On a different OJS 3.5 installation, I faced the same issue before and solve it with the following change, rewriting UserGroupHelper.php lines 43 and 44:

From:

 self::formatDate($data['dateStart']),
 $data['dateEnd'] ? self::formatDate($data['dateEnd']) : null

To:

 !empty($data['dateStart']) ? self::formatDate($data['dateStart']) : '',
 !empty($data['dateEnd']) ? self::formatDate($data['dateEnd']) : '',

With this change, I was able to complete the invitation. However, after the user accepts the new role, it seems that the role is registered but then automatically removed.

(author role was selectec by the user)

Logs recorded during the process:

[07-Oct-2025 05:29:32 America/Sao_Paulo] PHP Warning:  Undefined array key "dateEnd" in /lib/pkp/classes/invitation/invitations/userRoleAssignment/resources/BaseUserRoleAssignmentInviteResource.php on line 55
[07-Oct-2025 05:29:45 America/Sao_Paulo] PHP Warning:  Undefined array key "dateEnd" in /lib/pkp/classes/invitation/invitations/userRoleAssignment/resources/BaseUserRoleAssignmentInviteResource.php on line 55
[07-Oct-2025 05:29:46 America/Sao_Paulo] PHP Warning:  Undefined array key "dateEnd" in /lib/pkp/classes/invitation/invitations/userRoleAssignment/resources/BaseUserRoleAssignmentInviteResource.php on line 55
[07-Oct-2025 05:29:49 America/Sao_Paulo] PHP Warning:  Undefined array key "dateEnd" in /lib/pkp/classes/invitation/invitations/userRoleAssignment/resources/BaseUserRoleAssignmentInviteResource.php on line 55
[07-Oct-2025 05:30:09 America/Sao_Paulo] PHP Warning:  Undefined array key "dateEnd" in /lib/pkp/classes/invitation/invitations/userRoleAssignment/resources/BaseUserRoleAssignmentInviteResource.php on line 55
[07-Oct-2025 05:30:12 America/Sao_Paulo] PHP Warning:  Undefined array key "dateEnd" in /lib/pkp/classes/invitation/invitations/userRoleAssignment/resources/BaseUserRoleAssignmentInviteResource.php on line 55
[07-Oct-2025 05:31:29 America/Sao_Paulo] PHP Warning:  Undefined variable $isNewSubmissionLinkPresent in /lib/pkp/classes/template/PKPTemplateManager.php on line 1087
[07-Oct-2025 05:33:42 America/Sao_Paulo] PHP Warning:  Undefined array key "dateEnd" in /lib/pkp/classes/invitation/invitations/userRoleAssignment/resources/BaseUserRoleAssignmentInviteResource.php on line 55
[07-Oct-2025 05:33:49 America/Sao_Paulo] PHP Warning:  Undefined array key "dateEnd" in /lib/pkp/classes/invitation/invitations/userRoleAssignment/resources/BaseUserRoleAssignmentInviteResource.php on line 55
[07-Oct-2025 05:33:50 America/Sao_Paulo] PHP Warning:  Undefined array key "dateEnd" in /lib/pkp/classes/invitation/invitations/userRoleAssignment/resources/BaseUserRoleAssignmentInviteResource.php on line 55
[07-Oct-2025 05:33:54 America/Sao_Paulo] PHP Warning:  Undefined array key "dateEnd" in /lib/pkp/classes/invitation/invitations/userRoleAssignment/resources/BaseUserRoleAssignmentInviteResource.php on line 55
[07-Oct-2025 05:34:06 America/Sao_Paulo] PHP Warning:  Undefined variable $isNewSubmissionLinkPresent in /lib/pkp/classes/template/PKPTemplateManager.php on line 1087
[07-Oct-2025 05:34:07 America/Sao_Paulo] PHP Warning:  Undefined array key "dateEnd" in /lib/pkp/classes/invitation/invitations/userRoleAssignment/resources/BaseUserRoleAssignmentInviteResource.php on line 55
[07-Oct-2025 05:34:14 America/Sao_Paulo] PHP Warning:  Undefined array key "dateEnd" in /lib/pkp/classes/invitation/invitations/userRoleAssignment/resources/BaseUserRoleAssignmentInviteResource.php on line 55
[07-Oct-2025 05:34:17 America/Sao_Paulo] PHP Warning:  Undefined variable $isNewSubmissionLinkPresent in /lib/pkp/classes/template/PKPTemplateManager.php on line 1087

Because of this behavior, I cannot assign new roles to users via Journal Editor user invitations.

1 Like

Hi @geniusdesign,

There are several bugs related to the User Role Invitation (some already closed, and some still pending). It’s possible you are running up against these issues: GitHub · Where software is built

-Roger
PKP Team

1 Like

In Spanish, this problem not only persists, but the translation to find the template causing the error is also unavailable. Therefore, it’s more difficult for Spanish speakers to identify the error. However, here we are, getting to the root of the problem: A platform that requires role assignment cannot function if the email addresses for those roles cannot be assigned correctly. It’s like having a high-tech device that isn’t configured to do its job. Thank you, and we apologize for the inconvenience.

Hi @camilotorres,

A platform that requires role assignment cannot function if the email addresses for those roles cannot be assigned correctly. It’s like having a high-tech device that isn’t configured to do its job.

Can you describe in a little more detail what you mean by “if the email address for those roles cannot be assigned correctly”? Do you mean that the Editor, for example, is entering the wrong email address?

Thanks,
Alec Smecher
Public Knowledge Project Team

Hola @asmecher ,

The problem is that the system doesn’t allow me to assign a role, neither as a manager nor as an editor; it doesn’t allow me to assign user roles, primarily because it didn’t allow me to send invitation emails.

After resolving the SMTP sending issue, I noticed that due to the incomplete Spanish translation, the invitation template, “User Role Assignment Notice,” was blank in both the “Subject” and “Text” fields.

User Invited to Role Notification
This email is sent to users that are invited to obtain certain roles

Then, I proceed to customize said template, using the parameters “$”, and when making a test invitation, the parameter “{$roleAssignment}” does not work, it appears verbatim in the email received.

I have a big question, is that the correct parameter for sending the role invitation email to the user?

Thank you!,
Camilo Torres
OJS User

PD: Can someone share the email template with me? “User Invited to Role Notification”?

Hi @camilotorres,

There are still untranslated strings in the Spanish language translation, which is making this a lot tougher! You can see the body text for that template here:

https://translate.pkp.sfu.ca/translate/pkp-lib/emails/es/?q=emails.userRoleAssignmentInvitationNotify.body&sort_by=-priority%2Cposition&checksum=

Thanks,
Alec Smecher
Public Knowledge Project Team

Hi! @asmecher

Thank you so much! I was able to resolve it without any major difficulties. A little email customization and that was it! Thanks again!

1 Like

Hi @camilotorres,

Great, glad to hear it! Meanwhile, I’ve bumped our translator community to see if we can get these translations complete for the next releases.

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

Hello @asmecher ,

Excellent news. In any case, I made my contribution with this particular translation.

Regards,
Camilo Torres
Usuario OJS

1 Like

This topic was automatically closed after 12 days. New replies are no longer allowed.