replacing the email-templates of a survey?

Mehr
2 Monate 1 Woche her - 2 Monate 1 Woche her #183382 von 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.

$this->subscribe('beforeSave');
$this->subscribe('beforeSurveyLanguagesettingSave');


but those functions got not triggered :(



on the other side I noticed:
every time I save the survey, the mail templates are wrapped in a HTML page:
<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
<script type="text/javascript">window["_gaUserPrefs"] = { ioo : function() { return true; } }</script>
is inserted. (my text stays in the body-tag).



hooking into beforeSurveySave works without problems, but I can't hook into the other ones to modify the mail templates.
Letzte Änderung: 2 Monate 1 Woche her von bewi. Begründung: clarification

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

LimeSurvey Partners
Mehr
2 Monate 1 Woche her #183421 von bewi
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'

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
2 Monate 1 Woche her - 2 Monate 1 Woche her #183439 von DenisChenu
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

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand .
An error happen ? Before make a new topic : remind the Debug mode .
Letzte Änderung: 2 Monate 1 Woche her von DenisChenu.

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Mehr
2 Monate 1 Woche her #183440 von DenisChenu
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 .
An error happen ? Before make a new topic : remind the Debug mode .

Bitte Anmelden oder Registrieren um der Konversation beizutreten.

Jetzt loslegen!

Melden Sie sich jetzt an, und erstellen Sie in wenigen Minuten Ihre erste Umfrage.

Account einrichten

Abonnieren Sie unseren Newsletter

Abonnieren Sie unseren Newsletter für alle Neuigkeiten rund um LimeSurvey
captcha