Events in 5.5.1 needs the define.

Permalink 3 users found helpful
Just in case someone else runs into this:

I was following the events documentation and couldn't get my event to work. It only worked _after_ adding `define('ENABLE_APPLICATION_EVENTS', true);` to site.php. The documentation for events states `*NOTE: the above code is only need for concrete5 versions less than 5.4`. I'm using v5.5.1 so I didn't add the define per the docs. I decided to add the define after fighting with it for a bit.

 
Ale replied on at Permalink Reply
I'd like to bump up this thread because this is still an issue even in 5.6.1.2. It's true that if you have events in package controllers, you won't have to define ENABLE_APPLICATION_EVENTS in site.php as the documentation states. However, if you want to use events that you define in /config/site_events.php, you have to enable application events in site.php because of lines 134-136:

if (defined('ENABLE_APPLICATION_EVENTS') && ENABLE_APPLICATION_EVENTS == true &&  file_exists(DIR_CONFIG_SITE . '/site_events.php')) {
      @include(DIR_CONFIG_SITE . '/site_events.php');
   }


It would save many from coding frustration if the documentation was a bit more precise on the topic.
enlil replied on at Permalink Reply
enlil
interesting... I'm using 5.6.1.2 and im able to define events in site_events.php without ENABLE_APPLICATION_EVENTS in site.php...