I have the following code:

namespace Craft;

class AffiliatesExportPlugin extends BasePlugin
  //All other functions

  public function init() {
    craft()->on('entries.onDeleteEntry', function(Event $event) {
      Craft::log(" on delete ######\n\n", LogLevel::Info, true);

I added this as a plugin activated the plugin, but when I delete an entry, it doesn't seem to get triggered. What am I doing wrong?

  • How did you delete it? From the entry's edit screen? Or from the entries index screen (via the checkbox)?
    – Lindsey D
    Sep 22 '16 at 5:49
  • @lindsey-d Through the check boxes Sep 22 '16 at 5:49

Bulk actions do not trigger their respective events. When you delete an entry (or multiple entries) via the checkboxes, you are performing a bulk action.

As a workaround, you can listen to the onBeforePerformAction or onPerformAction events, check to see if the action parameter to see if it's the action you're interested in and perform your logic as necessary. *

* Much of this answer was copied from my & Brad's answers on this similar thread...

  • thanks for the response. I tried this: craft()->on('entry.onPerformAction ', function(Event $event) { Craft::log(" on delete ######\n\n", LogLevel::Info, true); }); . Doesn't seem to work, I tried it with just 'onPerformAction' as well, it doesn't work then either. Sep 22 '16 at 6:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.