You are viewing the PKP Support Forum | PKP Home Wiki

Defining new email templates and sending to a group.

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.

Defining new email templates and sending to a group.

Postby rmichael » Tue Jul 24, 2007 10:35 am

I'm just starting to read the class/mail/ code that handling the construction and delivery of email messages... but thought I would also ask:

I would like to write my own template and send an email message to a group of users. (In particular, to the editorial team group I defined to appear on our About -> Editorial Team page; so if I could use that group easily, it would be great.)

The OJS in an Hour documentation (p64) only mentions customizing existing templates, nothing about creating new ones (i.e. what variable names can be used -- although I can read other templates for most of them, I might also require new variables, e.g. given name for "Dear Richard"; what code sets up the variables for use in the template, etc. etc.).

Also, after I've created the template, how do I use the template in a message to a group (as opposed to clicking the email icon next to each user name)?
Posts: 113
Joined: Fri Mar 30, 2007 3:32 pm

Postby asmecher » Tue Jul 24, 2007 11:49 am

Hi Richard,

The easiest thing to do is probably to use the existing mail code that is invoked from the Journal Manager's "Masthead" / "Editorial Board" link (depending on your version of OJS). Beside each title there should be a mail icon that you can use to send a message to members of that group. This invokes pages/manager/ManagerHandler.inc.php::email, which accepts the "toGroup" parameter, which can optionally contain a group ID (i.e. Editorial Board position ID) to address the message to; you can also specify a "template" variable, which can be used to identify a template by symbolic name (e.g. REVIEWER_REQUEST).

To add additional parameters, you can add something like this:
Code: Select all
    'myVarName' => 'Here is the value of the variable',
    'myVarName2', 'Here is another variable value'
...and so on.

Alec Smecher
Public Knowledge Project Team
Posts: 9935
Joined: Wed Aug 10, 2005 12:56 pm

Postby rmichael » Wed Jul 25, 2007 3:07 pm

Perfect, this is exactly what I wanted, thanks Alec. I hadn't seen the ../manager/email page before. (Well, I've used it quite a few times when sending out messages, but without noticing the URL explicitly.)

I guess I was thinking about the problem differently.. rather than finding the entity to whom I wanted to send an email (and then looking for an email link/icon next to it), I was looking for a general "Send an email" management page, hoping it would contain a list of all entities which are valid recipients. Perhaps this functionality could be added to tasks under "Journal Management"? (Or maybe it's there somewhere and I've missed it.)

Thanks again!
Posts: 113
Joined: Fri Mar 30, 2007 3:32 pm

Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Yahoo [Bot] and 2 guests