We have a scenario where we want to take action in another application as a survey participant progresses through a survey. Since Limesurvey updates the response record as a participant progresses, we felt the best design approach would be to leverage a Plugin Event to extract the response.
The logical Event seemed to be "afterResponseSave", but it does not appear to be triggered at any point during a participant's interaction with a survey.
The "afterSurveyComplete" event works as intended but that doesn't get us what we need for partially completed surveys.
I did see a previous topic on events and Denis mentioned "afterResponseSave" might not be working as intended. If this is still true, does anyone have any suggestions for alternative ways using a plugin event to accomplish the goal of being notified each time a response is saved? Obviously, we could use a database trigger but would prefer to use plugin events if possible.
Thanks in advance for any thoughts.
$config = '3.15.6';
$config = 355;
$config = '190108';
$config = true;
$config = '30070';
I've attached a small sample survey and the plugin log from my testing using the following code. The purpose of the code was to just see how and when various events were being called. You can see that "afterResponseSave" and "afterSurveySave" are never reported as being invoked when you run through the sample survey.
Code:
<?php
class ShowResponse extends PluginBase {
protected $storage = 'DbStorage';
static protected $description = 'Demo: handle a survey response';
static protected $name = 'Show response';
public function init()
{
/**
* Here you should handle subscribing to the events your plugin will handle
*/
$this->subscribe('afterSurveyComplete', 'logEvent');
$this->subscribe('afterModelSave', 'logEvent');
$this->subscribe('afterSurveyDynamicSave','logEvent');
$this->subscribe('afterSurveySave','logEvent');
$this->subscribe('afterResponseSave','logEvent');
}
/*
* Below are the actual methods that handle events
*/
public function logEvent()
{
$event = $this->getEvent();
$this->log($event->getEventName(). ' was triggered successfully.');
}
}