Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

new PluginEvents afterSurveyActivate, afterSurveyDeactivate

  • bismark
  • bismark's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 5 months ago #176373 by bismark
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 5 months ago - 5 years 5 months ago #176426 by DenisChenu
beforeSurveySave allow to test current model VS new model
Code:
$oSurveyAfterSave = $this->getEvent()->get('model');
$oSurveyBeforeSave = Survey::model()->findByPk($oSurveyAfterSave->sid);

I already use it to «silently» disable some update …

We already need more better plugin in my opinion : need a real beforeEmail, need a beforeFind, afterFind

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 5 months ago by DenisChenu.
The topic has been locked.
  • bismark
  • bismark's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 5 months ago #176445 by bismark
after "beforeSurveyActivate" the Response table survey_123456 will be created. We need to trigger some actions on that event.
The topic has been locked.
  • Mazi
  • Mazi's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
5 years 5 months ago - 5 years 5 months ago #176635 by Mazi

DenisChenu wrote: I already use it to «silently» disable some update …

Hi Denis, does that mean that you have already created some lines of code for supporting an event like afterSurveyActivate?

Best regards/Beste Grüße,
Dr. Marcel Minke
Need Help? We offer professional Limesurvey support: survey-consulting.com
Contact: marcel.minke(at)survey-consulting.com
Last edit: 5 years 5 months ago by Mazi.
The topic has been locked.
  • bismark
  • bismark's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 5 months ago #176636 by bismark
for the afterSurveyActivate Event we added some code to activate_helper.php/activateSurvey-function:
Code:
$event = new PluginEvent('afterSurveyActivate');
$event->set('surveyId', $iSurveyID);
$event->set('simulate', $simulate);
App()->getPluginManager()->dispatchEvent($event);
 
return $aResult;
 

for the afterSurveyDeactivate Event we added some code to surveyadmin.php/deactivate-method
Code:
$event = new PluginEvent('afterSurveyDeactivate');
$event->set('surveyId', $iSurveyID);
App()->getPluginManager()->dispatchEvent($event);
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 5 months ago #176731 by DenisChenu

Mazi wrote:

DenisChenu wrote: I already use it to «silently» disable some update …

Hi Denis, does that mean that you have already created some lines of code for supporting an event like afterSurveyActivate?

Yes, but i use Permission event (testing the controller and POST value); Only for before activate.

@bismark : pull request can be done.

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.
  • bismark
  • bismark's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
5 years 5 months ago #176738 by bismark
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 5 months ago #176922 by DenisChenu

Mazi wrote:

DenisChenu wrote: I already use it to «silently» disable some update …

Hi Denis, does that mean that you have already created some lines of code for supporting an event like afterSurveyActivate?

Oh, got it : find it in another project

near beforeSurveySave event :
Code:
$savedSurvey = $this->getEvent()->get("model");
if($savedSurvey->sid && $savedSurvey->active == "Y") {
    $oldSurvey => Survey::model()->findByPk($savedSurvey->sid);
    if($oldSurvey && $oldSurvey->active != "Y") {
        // We are before survey is activated, after response DB created
    }
}

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.

Lime-years ahead

Online-surveys for every purse and purpose