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
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

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: 10015
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: Yahoo [Bot] and 2 guests