<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>

CC BY-SA 3.0
2016-04-11T16:44:44.267Z
2016-04-11T16:44:44.267Z
Lindsey D
<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>

CC BY-SA 3.0
2016-09-16T18:24:37.550Z
How do you get the ID(s) of the element(s) that the action is being performed on?
jthomas
CC BY-SA 3.0
2016-09-16T22:47:58.473Z
@jthomas Can you post that as a new question and I'll answer? Probably helpful to other people, too.
Brad Bell
CC BY-SA 3.0
2016-09-16T23:25:45.770Z
Yep, I'd be happy to.
jthomas
CC BY-SA 3.0
2016-09-17T14:42:30.630Z
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
jthomas
CC BY-SA 3.0
2016-04-11T18:16:41.967Z
2016-04-11T18:16:41.967Z
2017-04-13T12:50:59.930Z
Brad Bell
<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>

CC BY-SA 3.0
2016-04-11T16:46:04.823Z
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.
Lindsey D
<plugin-development><events>
Delete / change Status from CP via Ajax (trigger event)
# 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

[Lindsey'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**: @jthomas 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  

---

