Welcome to the LimeSurvey Community Forum

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

The sequence of events and their early termination

  • alorenc
  • alorenc's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 1 month ago #212403 by alorenc
  1. Where can I find a description of the sequence of called events?
  2. I would like to know if there are any events between boforeControllerAction and afterControllerAction?
  3. Is it possible to interrupt the execution of an event in such a way that the action following it does not execute?
    For example, if I catch the beforeControllerAction event, how can I prevent the action from being triggered after this event?
The topic has been locked.
  • alorenc
  • alorenc's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
3 years 1 month ago - 3 years 1 month ago #212408 by alorenc
ad 3)
If I use the "die()" function it will work. But I don't think that's good practice in this case. Example:
Code:
public function init()
    {
        $this->subscribe('beforeControllerAction');
    }
 
public function beforeControllerAction()
    {
        $isPostRequest = $this->api->getRequest()->getIsPostRequest();
 
        if (!$this->ownController && $isPostRequest && 'admin' == $this->event->get('controller') && 'tokens' == $this->event->get('action') && 'importldap' == $this->event->get('subaction')) {
            //... Here is to run another action from a different controller
            die();
        }
    }
Last edit: 3 years 1 month ago by alorenc.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 1 month ago #212444 by DenisChenu
1. We try manual.limesurvey.org/Plugin_events
2. manual.limesurvey.org/BeforeControllerAction , near after : beforeCloseHtml or getPluginTwigPath (not done for this but happen after all action done, just before HTML is produced (in survey))
3. see possible output `run` as false, you can replace any controller by your own or show any message (but this one is outdated : i start to use twig now)

I move this topic to developement

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