Adding {$articleid} to subject line in emails without templates - OJS

There are several emails that can be sent from the Summary, Review and Editing pages of a submission to authors or editors that do not have corresponding prepared emails (templates). It would be very helpful to get the articleID into the subject line of those emails. I see that there is a feature request for this: Add item ID on subject for all e-mail temlates

However, there are several other forum conversations that lead me to think that I could possibly associate newly created templates with the email icons that generate these untemplated emails or otherwise get the articleid into the email subject lines. Sadly, I’m having trouble following exactly what I need to do to accomplish this. I can see the article ID in the url to these untemplated emails! It seems like it should be so easy to grab that ID and get it into the subject line.

I guess I’ve got two possibilities here, either: a) get the email icons not associated with templates to associate with a new template or b) pull the ID out of the URL and put it in the subject line. I expect b would be easier.

Anyone have thoughts on what edits I need to make to accomplish either of these?

Hello @macdonaj,

I edited all my e-mail templates and added the {$articleId} whenever/wherever I needed them…
It was easier than trying to work with custom e-mail templates, that are not that simple to use, in my humble opinion.

And I used the standard Translation Plugin, available to the role of Administrator, usually first user created during installation. Or manually added the role to any user you’d want, manipulating the database directly.

1 Like

Hi @macdonaj,

Subjects for those emails are specified in the template file. For example, on the list of Editors with mail icons for each, see templates/sectionEditor/submission/editors.tpl:

{assign var=emailString value=$editAssignment->getEditorFullName()|concat:" <":$editAssignment->getEditorEmail():">"}
                                {url|assign:"url" page="user" op="email" redirectUrl=$currentUrl to=$emailString|to_array subject=$submission->getLocalizedTitle|strip_tags articleId=$submission->getId()}
                                {$editAssignment->getEditorFullName()|escape} {icon name="mail" url=$url}

The icon is generated using the {icon ...} smarty tag, with the $url assigned per the {url|assign:"url" ...} call above that. There, you can see the subject=... parameter.

To get the submission ID, you can use $submission->getId() function. So all you need to do is build the components into a string; for help on that, check the Smarty documentation.

Regards,
Alec Smecher
Public Knowledge Project Team

For anyone looking for a solution in OJS 3, all submission emails already have access to a {$submissionId} variable. It just isn’t added to the subject line by default. So you could do change eg. one of the editor decision emails so that its prepared email template read:

MS# {$submissionId}: Editor Decision

Cheers,
James

1 Like