How to add more field on user & roles

Hey, I am new on ojs 3, I want to add more boxes on user & roles like university and nationality … etc where I can find it at source code!

Doc12

Hello @NoorShomal,

Can you indicate which specific version of OJS (e.g. 3.3) you’re using? Modifying these pages requires familiarity with the application code and structure, you might want to check out our developer documentation here: PKP Developer Docs - Technical guides and documentation for OJS and OMP - if you haven’t done so already.

Best regards,

Roger
PKP Team

Hey @rcgillis, thanks for the reply :blush:!
Version OJS 3.2.1-1

Thanks, @NoorShomal. I’m not sure the best way to go about, modifying these fields, but I’ll see if members of our Dev Team - or possibly some community members may wish to share their advice.

-Roger
PKP Team

1 Like

Yes, please thank you so much!

Hi @NoorShomal,

Are there additional fields beyond university and nationality that you would like to add? I ask because adding additional information to the user like you are suggesting would involve creating a plugin to modify the form as well as store and retrieve the information from the database (we very strong recommend against directly editing the source code as this can have unintended consequences and make upgrading very difficult).

Within the user information form, the affiliation field is typically used to indicate a user/author’s university and a country selector is part of the general user details. Do these existing fields meet your needs?

If these fields meet your needs but you would like the names of these fields changed, this can be done using the Custom Locale Plugin, which can be installed from the plugin gallery within OJS. More information on the Custom Locale Plugin and how to install it can be found in the PKP Docs.

Regards,
Erik
PKP Team

Hey @ewhanson,

Thank you for the reply!

I am trying to add more field on the user & roles
this my step and also I get an error
step one:
lib.pkp.classes.user.php
also, add university
then I edit the frontend user

but still, nothing appears and I get an error!

image

Hi @NoorShomal,

This will likely be fairly tricky to do. To add fields to the user details you will need to create a plugin. You would need to include the additional fields, using something like the Common::UserDetails::AdditionalItems hook from userDetails.tpl. You would also need to ensure these are persisted to the database, but I’m not sure what all that would involve.

The PKP Docs hub has a guide on getting started with plugins that would be helpful. You could also look at the ORCID Profile plugin, as it adds additional information to the user details.

Hope that helps!

Regards,
Erik
PKP Team

1 Like

Hey @ewhanson

Thank you for the reply :)!

I did this step last week and it’s work finally!

thank you again!

Glad to hear it worked, @NoorShomal!