[Bug Report] OpenID Plugin: ORCID registration fails (Call to undefined method UserGroup::getId())

Application: OJS 3.5.0-0 (also confirmed in 3.5.0-1)

Plugin: OpenID

Environment: PHP 8.1 / MySQL 8 / Apache (cPanel)

Context: Registration via ORCID (OpenID provider)

Summary

When a new user registers using ORCID (through the OpenID plugin), the process stops after submitting the second registration step.

The browser displays a blank page, and the PHP error log shows a fatal error:

PHP Fatal error: Uncaught BadMethodCallException:
Call to undefined method PKP\userGroup\UserGroup::getId()

Steps to Reproduce

  1. Enable and configure the OpenID plugin with ORCID provider.

  2. Click “Register with ORCID” on the registration page.

  3. Authenticate successfully on ORCID.

  4. Choose “I am a new user” and fill in the form.

  5. Click Continue —> results in a blank page.

Actual Behavior

  • The registration process crashes.

  • The system logs a fatal error, and the page turns blank.

Error Trace

PHP Fatal error: Uncaught BadMethodCallException:
Call to undefined method PKP\userGroup\UserGroup::getId()
in /lib/pkp/lib/vendor/laravel/framework/src/Illuminate/Support/Traits/ForwardsCalls.php:67
Stack trace:
#0 …/plugins/generic/openid/forms/OpenIDStep2Form.php(369):
Illuminate\Database\Eloquent\Model::__call(‘getId’, Array)

Root Cause

In OJS 3.5, the UserGroup model was migrated to Eloquent and no longer provides a getId() method. Its primary key is now accessible via the Eloquent property $userGroup->id. However, the OpenID plugin (bundled version) still uses $defaultReaderGroup->getId(); inside OpenIDStep2Form::_registerUser() (around line 369).

Minimal Patch

In: plugins/generic/openid/forms/OpenIDStep2Form.php

replace line: Repo::userGroup()->assignUserToGroup($user->getId(), $defaultReaderGroup->getId());
with: Repo::userGroup()->assignUserToGroup($user->getId(), $defaultReaderGroup->id);

After Applying the Fix

ORCID registration completes successfully.

User is automatically logged in.

No PHP errors or blank page.

1 Like

@Pedro_Felipe_Rocha thanks for the fix!

This issue ([OpenID] | Register new user - Status 500 registering with Google · Issue #11818 · pkp/pkp-lib · GitHub), which also includes your patch, will be merged and included in the new plugin release within this week.

This release will also include fixes for:

I’m mentioning these here since they’re both related to your reports and for reference.

If you come across any other issues, it would be very helpful if you could open a GitHub issue similar to the one above. And of course, if you have any fixes to propose, we’d be happy to review and merge them where appropriate.

Thank you for using the OpenID plugin and for your testing efforts - they’re really helpful!

1 Like

Hi! Thanks for the reply. OpenID plugin is really great.

Next time I’ll open a GitHub issue report.

1 Like

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