OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Adding articleID in ALL email subjects

OJS development discussion, enhancement requests, third-party patches and plug-ins.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
Developer Resources:

Documentation: The OJS Technical Reference and the OJS API Reference are both available from the OJS Documentation page.

Git: You can access our public Git Repository here. Comprehensive Git usage instructions are available on the wiki.

Bugzilla: You can access our Bugzilla report tracker here.

Search: You can use our Google Custom Search to search across our main website, the support forum, and Bugzilla.

Questions and discussion are welcome, but if you have a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a technical support question, try the OJS Technical Support subforum.

Adding articleID in ALL email subjects

Postby mgscano » Wed Jul 14, 2010 3:17 am

Hi all,
I see there are a few other threads on this subject, but I just wanted to isolate this aspect, because to our journal (and I guess to many others) it's VITAL to have the submission ID # automatically included in all the emails going out from the site, exactly as the [<journal abbreviation>] tag.
We currently have never less than five new submissions per day, with a Review stage filled up with almost 150 items ... the number of emails every editor gets per day is quite high, and having at least the submission ID well printed there would make the work really really simpler (just consider searching/sorting your mailbox ...).

I'd like to customize it myself, even if I'm not really sure if I can do it, so I'm basically just asking for suggestions ... basically: where is the code I need to to change? Mind I want all the emails to sport the ID, also to avoid having to go 'round all the OJS code to make hundreds of small changes, which would make my code updates barely unmanageable.

Thanks,

Marco
mgscano
 
Posts: 72
Joined: Tue Jan 27, 2009 3:22 am
Location: Brescia, Italy

Re: Adding articleID in ALL email subjects

Postby mcrider » Thu Jul 15, 2010 2:26 pm

Hi Marco,

You can play around with the ArticleMailTemplate class (classes/mail/ArticleMailTemplate.inc.php), since the ArticleMailTemplate (as opposed to the regular MailTemplate) class will always be assured to have an article associated with it and thus not produce errors if you're trying to get an article ID.

I haven't tested this or anything, but you should be able to do this by putting this line in the constructor of the ArticleMailTemplate (around line 53):
Code: Select all
$this->setSubject("[Article " . $article->getId() . "]" . $this->getSubject());


Cheers,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: Adding articleID in ALL email subjects

Postby mgscano » Fri Jul 16, 2010 10:01 am

Hey Matt,
to properly get the articleId it needs a small edit, like:
Code: Select all
$this->setSubject("[Article " . $article->getArticleId() . "]" . $this->getSubject());

it works also in all the editors' correspondence, thanks a lot for the hint.

However, the final result is not very fancy, since you get something like:

[Article <ID>] [<jabbrev>] Email subject

while I wanted to get something like:

[<jabbrev>] [Article <ID>] Email subject

... which is not different from a scientific guy PoV, but it drives designers crazy. And I have to deal with them.

That's why I was asking if there was a way to modify the string as it does when it throws in the <journalabbreviation>, but the subject must be contructed somewhere else, because in the ArticleMailTemplate it comes already with the [jabbrev] tag.

I'll try to split the string and insert my code in between. You'll see all progresses here.

thanks,

Marco
mgscano
 
Posts: 72
Joined: Tue Jan 27, 2009 3:22 am
Location: Brescia, Italy

Re: Adding articleID in ALL email subjects

Postby mcrider » Fri Jul 16, 2010 10:20 am

Hi Marco,

mgscano wrote:to properly get the articleId it needs a small edit, like:
Code: Select all
$this->setSubject("[Article " . $article->getArticleId() . "]" . $this->getSubject());

it works also in all the editors' correspondence, thanks a lot for the hint.


Sorry, yes, you'll need to do that--But when you upgrade, you'll have to change it to the way I originally wrote it, i.e., we've changed $article->getArticleId() to $article->getId() everywhere in an effort to maintain consistency in an object-oriented design.

mgscano wrote:... which is not different from a scientific guy PoV, but it drives designers crazy. And I have to deal with them.


Yeah, I know how that goes ;)...

The subject is actually constructed near the end of the classes/mail/MailTemplate.inc.php constructor function, and you can rejig some code so that has access to the article object (and thus the ID)... But your easiest solution is to split the string like you suggested. Should just be a couple lines of code, and will definitely get the job done.

Cheers,
Matt
mcrider
 
Posts: 952
Joined: Mon May 05, 2008 10:29 am
Location: Vancouver, BC

Re: Adding articleID in ALL email subjects

Postby mgscano » Tue Jul 20, 2010 9:16 am

HI Matt,
more news from the eastern front ...

So, there is a strange behaviour with the article ID#, because with the code we discussed before, the subject is okay until you see it in the mail form on the site, but when the message is sent, the article ID is included twice :? .
Still I wonder how it comes out, the searching goes on.

Then, I tried to split the variable with something like this:

Code: Select all
list($newName, $newSubject) = explode("]", $this->getSubject);
$this->setSubject($newName . "] - #" . $article->getArticleId() . $newSubject);


.. but nothing happens, as if the string was not really yet formed, I get only the text and the article ID.

All these things make me wonder that the getSubject should be accessed in another way, but I don't want to mess up things in too many files, for the same ole' reason that I'd like to survive the updates. So if all the editing could be limited to this file, it would be great.

thanks for the help, this aspect has become vital for our journal.

bye,
Marco
mgscano
 
Posts: 72
Joined: Tue Jan 27, 2009 3:22 am
Location: Brescia, Italy


Return to OJS Development

Who is online

Users browsing this forum: Bing [Bot] and 3 guests

cron