Answers.Body: <p>Unfortunately, this is a known bug in Craft. <strong>Bulk actions do not trigger their respective events.</strong></p>
  
  <p>I'm not sure when (if?) a solution will appear. I'm guessing that it won't be fixed in the 2.x branch, since this bug has existed for quite awhile now. With any luck, it'll be fixed when Craft 3 launches.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-11T16:44:44.267Z
Answers.LastActivityDate: 2016-04-11T16:44:44.267Z
Answers.UserDisplayName: Lindsey D
Answers.Body: <p><a href="https://craftcms.stackexchange.com/a/14611/57">Lindsey's answer</a> is correct, but as a workaround, you can listen to the <a href="https://craftcms.com/docs/plugins/events-reference#elements-onBeforePerformAction" rel="nofollow noreferrer">onBeforePerformAction</a> or <a href="https://craftcms.com/docs/plugins/events-reference#elements-onPerformAction" rel="nofollow noreferrer">onPerformAction</a> 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.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-16T18:24:37.550Z
Answers.Text: How do you get the ID(s) of the element(s) that the action is being performed on?
Answers.UserDisplayName: jthomas
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-16T22:47:58.473Z
Answers.Text: @jthomas Can you post that as a new question and I'll answer? Probably helpful to other people, too.
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-16T23:25:45.770Z
Answers.Text: Yep, I'd be happy to.
Answers.UserDisplayName: jthomas
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-09-17T14:42:30.630Z
Answers.Text: Question and answer here: http://craftcms.stackexchange.com/questions/16831/get-the-type-of-action-and-the-elementss-that-an-action-is-being-performed-on
Answers.UserDisplayName: jthomas
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-11T18:16:41.967Z
Answers.LastActivityDate: 2016-04-11T18:16:41.967Z
Answers.LastEditDate: 2017-04-13T12:50:59.930Z
Answers.UserDisplayName: Brad Bell
Body: <p>In a plugin init function I'm listening to <code>entries.saveEntry</code> and <code>entries.deleteEntry</code>. This works perfectly if I'm editing entries from their detail view. If I 'bulk' change or delete entries, these events are not fired. I saw in the <code>SetStatusElementAction</code> class an event called <code>onSetStatus</code> is triggered but how can I listen to it? The same goes with the delete action. </p>
  
  <p>Somehow the following doesn't get triggered for me:</p>
  
  <pre><code>craft()-&gt;on('entries.setStatus', function($event){ dd($event); });
  </code></pre>
  
  <p>What am I missing here?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-11T16:46:04.823Z
Comments.Text: Typically, we'd close something like this as a "bug report". But since this is a long-standing known bug, we'll keep the thread open until it eventually gets fixed.
Comments.UserDisplayName: Lindsey D
Tags: <plugin-development><events>
Title: Delete / change Status from CP via Ajax (trigger event)
ThreadText: # Delete / change Status from CP via Ajax (trigger event)
  
  (Asked by: username_0 on 2015-03-02)
  
  In a plugin init function I'm listening to `entries.saveEntry` and `entries.deleteEntry`. This works perfectly if I'm editing entries from their detail view. If I 'bulk' change or delete entries, these events are not fired. I saw in the `SetStatusElementAction` class an event called `onSetStatus` is triggered but how can I listen to it? The same goes with the delete action.
  
  Somehow the following doesn't get triggered for me:
  
  ```
  craft()->on('entries.setStatus', function($event){ dd($event); });
  
  ```
  
  What am I missing here?
  
  **Tags:** plugin-development, events
  
  > **Comments:**
  > **username_1**: Typically, we'd close something like this as a "bug report". But since this is a long-standing known bug, we'll keep the thread open until it eventually gets fixed.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-04-11. Score: 2
  
  Unfortunately, this is a known bug in Craft. **Bulk actions do not trigger their respective events.**
  
  I'm not sure when (if?) a solution will appear. I'm guessing that it won't be fixed in the 2.x branch, since this bug has existed for quite awhile now. With any luck, it'll be fixed when Craft 3 launches.
  
  
  ---
  
  ### Answer by username_2 on 2016-04-11. Score: 1
  
  [username_1's answer](https://craftcms.stackexchange.com/a/14611/57) is correct, but as a workaround, you can listen to the [onBeforePerformAction](https://craftcms.com/docs/plugins/events-reference#elements-onBeforePerformAction) or [onPerformAction](https://craftcms.com/docs/plugins/events-reference#elements-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.
  
  > **Comments:**
  > **username_3**: How do you get the ID(s) of the element(s) that the action is being performed on?  
  > **username_2**: @username_3 Can you post that as a new question and I'll answer? Probably helpful to other people, too.  
  > **username_3**: Yep, I'd be happy to.  
  > **username_3**: Question and answer here: http://craftcms.stackexchange.com/questions/16831/get-the-type-of-action-and-the-elementss-that-an-action-is-being-performed-on  
  
  ---
  
  