OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



changing editor's names in email templates

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

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

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

changing editor's names in email templates

Postby arachne » Wed Feb 14, 2007 12:29 pm

Hi - brand new to OJS, testing my implementation now... brilliant software, I think it will make a huge difference for us!

A quick Q - I have no training in PHP, so just get by on the odd 'plug it in' support message etc.

I'd like to change the email templates for section editors (i.e. EDITOR_ASSIGN) to just use first names rather than the more formal full name for both them and myself as Editor (with "$editorialContactName" & "$editorialContactSignature").

Is there a different term that will let me just call the first name, i.e. "$editorialFirstName" or some such? I tried to crack open the 'profiles' template to see the names for the inputs but didn't work when I plugged in "firstName" to the template. I am sure I am missing a step or the point, one of the two. :)

I figure I can just add everyone's name in manually when I send each email, but it would be great if it were automatic.

Thanks!

jenea
arachne
 
Posts: 52
Joined: Sun Feb 11, 2007 3:46 pm
Location: Vancouver

Postby asmecher » Wed Feb 14, 2007 1:29 pm

Hi Jenea,

This will require a PHP change, but it's fairly straight-forward. Follow these steps:
  • Find the symbolic name of the email. This is the leftmost column in the Journal Manager's "Prepared Emails" section; if it's truncated, you can click "Edit" and pick it out of the end of the URL. It'll look something like COPYEDIT_ACK.
  • Find the code that invokes this template by searching through the OJS PHP. In Windows, you can probably use the "Find" feature to do this; in a UNIX-like environment, I'd run this from the OJS installation directory:
    Code: Select all
    fgrep -l EDITOR_ASSIGN `find . -name \*.php`
    This will list all files that mention this email by name. In this case, I find classes/submission/sectionEditor/SectionEditorAction.inc.php.
  • Find where the email is invoked from the file found above:
    Code: Select all
     $email = &new ArticleMailTemplate($editorSubmission, 'EDITOR_ASSIGN');
  • Looking further down in the same code block, you can see where the variables are assigned:
    Code: Select all
    $email->addRecipient($copyeditor->getEmail(), $copyeditor->getFullName());
    $paramArray = array(
        'editorialContactName' => $sectionEditor->getFullName(),
        'editorUsername' => $sectionEditor->getUsername(),
        'editorPassword' => $sectionEditor->getPassword(),
        'editorialContactSignature' => $user->getContactSignature(),
        'submissionUrl' => Request::url(null, 'sectionEditor', 'submissionReview', $articleId),
        'submissionEditingUrl' => Request::url(null, 'sectionEditor', 'submissionReview', $articleId)
    );
    $email->assignParams($paramArray);
  • Here you can add a new parameter to the $paramArray by inserting the following line in the middle of the above list:
    Code: Select all
    'editorFirstName' => $sectionEditor->getFirstName(),
  • Now add this variable to your email template and you're ready to go.

Keep in mind that every time you modify OJS, you risk complicating the upgrade process; however, if you use patch-based upgrades (as described in docs/README) you should be OK.

Regards,
Alec Smecher
Open Journal Systems Team
---
Don't miss the First International PKP Scholarly Publishing Conference
July 11 - 13, 2007, Vancouver, BC, Canada
http://ocs.sfu.ca/pkp2007/
asmecher
 
Posts: 8319
Joined: Wed Aug 10, 2005 12:56 pm

Postby arachne » Wed Feb 14, 2007 3:34 pm

Great, I'll give this a shot!
arachne
 
Posts: 52
Joined: Sun Feb 11, 2007 3:46 pm
Location: Vancouver

Postby arachne » Fri Feb 16, 2007 1:57 pm

Okay - didn't find the terms or code in the file you noted, I found them here: classes/submission/editor/EditorAction.inc.php

but the rest - for copyeditors, etc - I did find in SectionEditorAction.inc.php.

Code: Select all
$email->addRecipient($sectionEditor->getEmail(), $sectionEditor->getFullName());
            $paramArray = array(
               'editorialContactName' => $sectionEditor->getFullName(),
               'editorFirstName' => $sectionEditor->getFirstName(),
               'editorUsername' => $sectionEditor->getUsername(),
               'editorPassword' => $sectionEditor->getPassword(),
               'chiefedFirstName' => $user->getFirstName(),
               'editorialContactSignature' => $user->getContactSignature(),


I changed both the editor's name ('editorFirstName') and my own ('chiefedFirstName') - it worked great! Thanks. Now it's much more like the informal communication we use internally.
arachne
 
Posts: 52
Joined: Sun Feb 11, 2007 3:46 pm
Location: Vancouver


Return to OJS Technical Support

Who is online

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