[OCS] Custom e-mail template not being loaded right

Hello there,

I am creating a plugin based on paypal plugin. I have tried to create custom email templates just like paypal plugin have done. My problem is that when emails are sent, the body of these emails appears blank, with just the conference signature. I tried to debug to see whats going on, but seems to me that everything is working fine until a query which gets the template in the DB, on tables like email_templates, email_templates_data, email_templates_default, email_templates_default_data. I see that there is nothing on these table about my plugin, but about paypal’s there is. Do I have to add something on these tables manualy? How to use those tables?

PS: OCS 2.3.6.0

Hi @Israel87,

Email templates are loaded from the .xml files into the database when the system is installed or a plugin is installed through the web-based upload tool. For local development with a plugin, you can create the templates through the web interface using the Conference Manager’s “Prepared Emails” area; just paste the values from the XML file into the relevant fields.

Regards,
Alec Smecher
Public Knowledge Project Team

It worked! Thank you Alec!

Just for clarity, what do you mean by “installed through the web-based upload tool”? Is it through Journal Management > Plugin Management > Install a new plugin? If it is, what i need to do in order to create a plugin in this format to be installed? Just compress it?

Yes, the web based installer is User Home - > Manager → System Plugins → Install a new plugin.

To package your plugin, you would tar and gzip the plugin directory to a compressed archive.

Nice, thank you ctgraham.
Sorry, I pointed the ojs’s path. The real path is the one you said.

It seems that I have to create the same email templates for every conference. Is there a way to create these templates once for all?

Hi @Israel87,

Are these conferences you’ve already created, or new ones since you’ve had the plugin in place?

Regards,
Alec Smecher
Public Knowledge Project Team

Its a new conference. I created the emails through Prepared Emails area, and later, a new conference, but these emails were not available for this new conference, just for the conference first created.

Hi @Israel87,

Can you post the code for the plugin somewhere (ideally Github)?

Regards,
Alec Smecher
Public Knowledge Project Team

I sent you a private message.

The prepared Email area is per conference, isn’t it?

Hi @Israel87,

OCS has a two-level structure that often causes confusion – “Conference” (e.g. PKP Scholarly Publishing Conference), and “Scheduled Event” below that (e.g. PKP Scholarly Publishing Conference 2013, PKP Scholarly Publishing Conference 2015).

The “Prepared Emails” area is attached to the Conference, not the Scheduled Event. Email templates should be added to the Conference when it is created.

If you’ve created a new Conference after your plugin was put in place, but the emails haven’t been attached to the new Conference, can you check to see whether you have entries in your email_templates_default and email_templates_default_data tables for the plugin?

Regards,
Alec Smecher
Public Knowledge Project Team

There are entries for the templates I created in the following tables: email_templates, email_templates_data, email_templates_default_data. There is not in email_templates_default.

The emails are working fine for the conference which I created the templates through “Prepared Email” area. The problem is with the new conference. The new conference emails are sent, but with no body, just the conference signature. When I browse to “Prepared Email” area in the old conference, I can see my templates. When I browse to the new conference, I can’t.

I wonder if it is possible to automatically let those templates available for new conferences (diferent conferences, not scheduled events in the same conference).

Hi @Israel87,

I suspect the missing entry in email_templates_deafult may be the problem. Try creating that, then creating a new conference for test purposes, and see if the right template shows up in “Prepared Emails”.

Regards,
Alec Smecher
Public Knowledge Project Team

I noticed that one of my templates had the attribute “email_key” bigger than 30 characters. It seems that email_template_default suports up to 30 characters. So I deleted all my templates and tried o create it again through “prepared emails” using a small name. But I had the same problem with a new conference, this time entries were added just to email_template and email_templates_data, not to the email_templates_default and email_templates_default_data.

Then I did what you said, I added the missing entries in email_templates_default and email_templates_default_data and it worked fine for a new conference. On tests, the templates worked fine with just entries in email_template_default and email_templates_default_data. So i’m going to leave it like this.

When I move to production enviroment I’ll add these entries manually. Is it the better approuch?

Thanks for such a help Alec and ctgraham!

Hi @Israel87,

Entries to email_templates_default and email_templates_default_data should be created when the plugin is installed, but if you’re tinkering with it on your dev system and e.g. have changed the email key to shorten it down, then of course the installation process won’t have been run again.

The difference between e.g. email_templates_default and email_templates is that email_templates_default is used for all conferences, unless there is something conference-specific to override it in email_templates. When you customize the default, then an entry gets created in email_templates.

Regards,
Alec Smecher
Public Knowledge Project Team

Sorry, I’ve forgotten that about the plugin instalation for a moment.

Thanks again.