- Posts: 21
- Thank you received: 2
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
replacing the email-templates of a survey?
- bewi
- Topic Author
- Offline
- Junior Member
Less
More
5 years 3 days ago - 5 years 3 days ago #183382
by bewi
replacing the email-templates of a survey? was created by bewi
I want to replace the emailtemplates of a survey. as only superadmins should be able to change the default texts I wanted to get the texts in the plugin configuration.
later on on every save of the survey it's mail-templates should be replaced.
I got the fields to enter the value in the plugin configuration and it's content is saved in the table lime_plugin_settings.
as the mail templates are stored in lime_surveys_languagesettings I tried to hook into the save event.
but those functions got not triggered
[hr]
on the other side I noticed:
every time I save the survey, the mail templates are wrapped in a HTML page:
and with each save another line
is inserted. (my text stays in the body-tag).
[hr]
hooking into beforeSurveySave works without problems, but I can't hook into the other ones to modify the mail templates.
later on on every save of the survey it's mail-templates should be replaced.
I got the fields to enter the value in the plugin configuration and it's content is saved in the table lime_plugin_settings.
as the mail templates are stored in lime_surveys_languagesettings I tried to hook into the save event.
$this->subscribe('beforeSave');
$this->subscribe('beforeSurveyLanguagesettingSave');
but those functions got not triggered
[hr]
on the other side I noticed:
every time I save the survey, the mail templates are wrapped in a HTML page:
Code:
<html> <script type="text/javascript">window["_gaUserPrefs"] = { ioo : function() { return true; } }</script> <script type="text/javascript">window["_gaUserPrefs"] = { ioo : function() { return true; } }</script> : <script type="text/javascript">window["_gaUserPrefs"] = { ioo : function() { return true; } }</script> <script type="text/javascript">window["_gaUserPrefs"] = { ioo : function() { return true; } }</script> <head> <title></title> </head> <body>my template text</body> </html>
and with each save another line
Code:
<script type="text/javascript">window["_gaUserPrefs"] = { ioo : function() { return true; } }</script>
[hr]
hooking into beforeSurveySave works without problems, but I can't hook into the other ones to modify the mail templates.
Last edit: 5 years 3 days ago by bewi. Reason: clarification
The topic has been locked.
- bewi
- Topic Author
- Offline
- Junior Member
Less
More
- Posts: 21
- Thank you received: 2
5 years 2 days ago #183421
by bewi
Replied by bewi on topic replacing the email-templates of a survey?
Although it is a weird behaviour to wrap text in a full html structur, the insertion of the Google analytics calls appears only with our 'old' firefox. In our company we have not the newest version, but an version with special extended LTS: 60.6.1esr (64-Bit)
Here I have some Javascript errors, I don't get with newest chrome (73.0.3683.103 (64-Bit))
I don't know wether this is the cause of misbehaviour, in chrome I only get a HTML/BODY-wrap with no GA-javascript. but that also seems strange.
At last I found my error:
the event no longer is named 'beforeSave' but 'beforeModelSave'
Here I have some Javascript errors, I don't get with newest chrome (73.0.3683.103 (64-Bit))
I don't know wether this is the cause of misbehaviour, in chrome I only get a HTML/BODY-wrap with no GA-javascript. but that also seems strange.
At last I found my error:
the event no longer is named 'beforeSave' but 'beforeModelSave'
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
5 years 1 day ago - 5 years 1 day ago #183439
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic replacing the email-templates of a survey?
beforeModelSave is for all models : beforeSurveyLanguageSettingSave must work for SurveyLanguageSetting model only.
(see the Capitalize)
else beforeSave is the event LimeSurvey use fro Yii : it never work for LimeSurvey plugin
(see the Capitalize)
else beforeSave is the event LimeSurvey use fro Yii : it never work for LimeSurvey plugin
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 5 years 1 day ago by DenisChenu.
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13597
- Thank you received: 2487
5 years 1 day ago #183440
by DenisChenu
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Replied by DenisChenu on topic replacing the email-templates of a survey?
Else about _gaUserPrefs : did you try deactivate all FireFox plugin ?
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.