[OJS 3] custom metadata fields

Hi @kardeiz,

Agreed, it’s not trivial to jump in and add a field. I think there are a couple of write-ups on OJS2 in the forum, but probably nothing yet for OJS3. Perhaps this would be a good chance to improve that situation :slight_smile:

Before I add some pointers – can I ask what the metadata you’d like to store is? Is it scholarly metadata, or some kind of instruction for during the workflow, or something else?

Alec Smecher
Public Knowledge Project Team

@asmecher, cool, thanks!

Well, for my particular situation, this would be free text, an epigraph/notes provided by the author’s advisor (it’s a journal of undergraduate scholarship) that would be similar to but separate from the abstract. It wouldn’t affect any workflow logic. It could be in the initial submission workflow or not, as long as it was available in the Submission->Workflow->Production->Metadata section. TinyMCE integration would be nice but a simple textarea would be fine.

It would then just be displayed on the article view page. I could take it from there: article_details.tpl and related are pretty easy to follow.

Any help you could provide would be much appreciated. Thanks!

Hi @kardeiz,

When would this be added to the content? For example, upon acceptance (= entry into the production/publication part of the workflow)?

We’re looking at adding some generic content-management tools permitting better control over the published presentation of a submission, mostly for OMP, but also applicable to OJS. I’m wondering whether this would be a good candidate for an OJS requirement.

Alec Smecher
Public Knowledge Project Team

Correct, in my use case this information would be provided only by an editor/admin (i.e. in the production phase). It wouldn’t be harmful to display the field/textarea it on submission, though, so whatever is easier or more generic would be fine for me.

Hi @kardeiz,

This seems like a good application of the kind of content management tools for publication that I mentioned above, rather than a metadata field like the DC set. Tagging @stranack, as he’s doing some related requirements work on OMP.

Alec Smecher
Public Knowledge Project Team

@asmecher, thanks, that sounds like the best solution—

If you have any pointers, though, for doing this with the current Submission class, they would be much appreciated, as I need to implement this sooner rather than later…


Hi @kardeiz,

For a quicker fix, I’d suggest grepping through the code for a similar metadata field and following its pattern – e.g. “coverage”, since that term isn’t used elsewhere in a different way, and it doesn’t have many dependencies.

Alec Smecher
Public Knowledge Project Team

@asmecher, thanks, that was helpful—

For anyone else looking to add custom metadata (in the most minimal kind of way—this doesn’t tie in with the translation system, DC, etc.), here is what you need to modify:

In lib/pkp/classes/submission/PKPSubmissionMetadataFormImplementation.inc.php:

  • In the initData function, add 'myField' => $submission->getData('myField', null) to the formData var
  • In readInputData, add 'myField' to the userVars var
  • In getLocaleFieldNames, add 'myField' to the array (not sure if this is necessary)

In lib/pkp/classes/submission/SubmissionDAO.inc.php: in getLocaleFieldNames, add 'myField' to the array

In lib/pkp/templates/submission/submissionMetadataFormTitleFields.tpl: append something like the following to the end of the template (here is a case where you might want to do some extra work to integrate with translations):

{fbvFormSection title="MyField" for="myField" required=false}
    {fbvElement type="textarea" multilingual=true name="myField" id="myField" value=$myField rich="extended" readonly=$readOnly}

In plugins/themes/bootstrap3/templates/frontend/objects/article_details.tpl (or similar): add the following where desired:

{if $article->getLocalizedData('myField') }
    <div class="article-summary" id="myField">
        <h2>My Field</h2>
        <div class="article-myField">


Connected to this thread I uploaded a plugin I worked on few weeks ago to github: https://github.com/ajnyga/customMetadata

It is basically a plugin that enables you to create new custom metadata fields using the database. I am not going to use it myself, because I only need one custom metadata field and the same plugin that creates that field does a lot of different things as well. But if someone has been thinking of something similar I did above, then my plugin is probably worth checking first.

At the moment it only supports single locale and only a text input field, but the concept could be easily expanded to support multilingual fields and for example textarea as well. Also notice that if someone tries the plugin, it does not at the moment create the required database table.

Edit: the plugin is based on https://github.com/pkp/ojs/tree/master/plugins/generic/openAIRE

Edit2: and a filled database table would look something like this (note that the plugin does not use all the fields at the moment):


Hi @ajnyga,

I’ve installed your Custom Metadata Plugin and it worked for me. The context_id corresponds to the current Journal ID, is that right?

If I have more journals than one, should there be more rows in the table, some for each journal, is this the intention?

What if I want to use the Quicksubmit Plugin, shouldn’t this plugin also alter the Quicksubmit Plugin, which is probably not that easy?



Disclaimer: it is not a ready-to-use plugin, just a concept that someone maybe can work on :slight_smile:

Yes, the context_id basically means the journal id.

You need a row for each journal. I was thinking that different journals may need different fields.

It is not hooked to the quicksubmit plugin. I am not sure if that is possible, if there is a hook available there? @bozana @asmecher?


yes, I know it’s not ready-to-use, I was just asking.:slight_smile:
It would be possible just to quicksubmit an article and later in the workflow alter the metadata…

Yes, I am just washing my hands off any mess the plugin creates :smiley:

If the quicksubmit plugin has some sort of hook in metadata section then it should be fairly easy to implement it there. I think that this is a more general question: there are many other plugins that would benefit from being able to hook into quicksubmit.

Hi all,

QuickSubmit plugin does use already existing component, but I am not sure if that is enough – I will have to check, if all necessary hooks are there… I will then come back to you again…


Hello Guys,

I have some articles without Abstract and the Abstract field is Mandatory during submission , How can i change this Mandatory field to normal ?



I got it, Thanks much!

Hi @bozana,

is there a hook into the quicksubmit plugin to add new metadata fields?

Hi all, sorry for the late response…

Yes, the QuickSubmit plugin uses the existing components and thus also the hook Templates::Submission::SubmissionMetadataForm::AdditionalMetadata.
You would however have to consider the QuickSubmitForm in your plugin, similar like OpenAIRE plugin is considering the SubmissionSubmitStep3Form in these code lines:

In general, the OpenAIRE plugin is a good example how to extend the article metadata with an additional filed – what hooks should be used and how to do that. Additionally to the code lines above s. also:

One code line is missing in the QuickSubmit plugin to enable saving of the additional field. S. this issue for that and the patch is coming: https://github.com/pkp/pkp-lib/issues/3121


1 Like

Hi bozana,
thank you! It works perfectly.