Adding custom data to submission settings


it seems that it’s possible to add custom data to the settings of a subbmission, like this:

$submissionDao->updateSetting($submissionId, 'fidusUrl', [none => $fidusUrl], 'string', True);

This works fine. The problem is that there doesn’t seem to be a way of getting this data back out without adding an SQL query:

function getSubmissionSetting($submissionId, $settingName) {
	$submissionDao = Application::getSubmissionDAO();
	$result = $submissionDao->retrieve(
		'SELECT setting_value
		FROM submission_settings
		WHERE setting_name = ? and submission_id = ? ;',
	$returner = false;
	if ($result->RecordCount() != 0) {
		$returner = $result->fields[0];

	return $returner;

Is there something I am missing here? I see that adding custom data is being used in at least one of the plugins, but they are then very limited when it comes to getting this back out again. (And yes, I realize this doesn’t work for localized settings.)

Hi @Johannes_Wilm,

The submission object should have all data from the submission settings added during a regular fetch of the object (OTOH – please let me know if it’s not behaving for you this way). You should be able to fetch it by using $article->getData('settingName'); after it’s fetched.

The mechanics of this are in the getDataObjectSettings call in lib/pkp/classes/submission/'s _fromRow function.

Alec Smecher
Public Knowledge Project Team

Hey, @asmecher , That’s what I tried first, but it only worked for me in the case of the default fields, not any custom setting names I used. Do I maybe need to declare these custom setting names somewhere?

Hi @Johannes_Wilm,

That’s the case for adding settings – see SubmissionDAO::getAdditionalFieldNames if you want to persist new settings using setData rather than calling SubmissionDAO::updateSetting as you have above – but shouldn’t be for fetching settings, I don’t think.

Alec Smecher
Public Knowledge Project Team

Weird. It seems to work now. I have been changing various other things in the meantime as well as pulled an update of OJS and pkp-lib from github. May just have been my clumsiness with php.

Anyway, thanks! I will be looking into SubmissionDAO::getAdditionalFieldNames to see what advantages that’ll give me.