<p>There isn't an "event" that gets fired when an entry goes live, but you should be able to listen to the <code>onSaveEntry</code> event, then check the <a href="https://craftcms.stackexchange.com/questions/11686/set-status-in-a-plugin/11693#11693">same criteria</a> that Craft uses to determine if an entry is live or not.</p>

<p>As far as tracking if it's the first time the entry had a live status or not, it's kind of lame, but your plugin could have a <a href="https://craftcms.com/docs/plugins/records" rel="nofollow">Record</a>/table that kept track of the entry ID and status so you'd know if it was the first time an entry ID had a status of Live or not.</p>

CC BY-SA 3.0
2016-07-07T01:19:15.523Z
Would there be a way to differentiate between the first time it's published live and if it gets saved again, like if a typo needed to be corrected or something?
John O
CC BY-SA 3.0
2016-07-07T04:27:24.467Z
Updated answer.
Brad Bell
CC BY-SA 3.0
2016-07-07T17:30:12.883Z
Correct me if I'm wrong... you wouldn't even need a separate Record/table. You could simply have a separate field on the entry, which would get updated once the entry goes live. (A date field would work nicely here.)
Lindsey D
CC BY-SA 3.0
2016-07-07T18:34:18.027Z
@LindseyD yup, that should work, too
Brad Bell
CC BY-SA 3.0
2016-07-06T22:26:02.623Z
2016-07-07T04:27:18.623Z
2016-07-07T04:27:18.623Z
Brad Bell
<p>Is there a way, via an Event or otherwise, to catch the first time a post is saved and isn't in disabled mode? I want to send out an email alert to users when a new entry is published, but I want it to be possible to work on it in disabled mode first.</p>

<p>If I use the <code>entries.onSaveEntry</code> event, it comes with the a param for isNewEntry, but I can't use this because it's only true the very first time an entry is saved, even if it's saved in disabled status. After that it will always return false.</p>

<p>It wouldn't be difficult to add an additional field to the entry that would track whether or not emails were sent, but I was wondering if there's a more straightforward way to handle it.</p>

<entry><events><saveentry>
Checking for first time an entry is "published" i.e. saved with a Live status
# Checking for first time an entry is "published" i.e. saved with a Live status

(Asked by: username_0 on 2016-07-06)

Is there a way, via an Event or otherwise, to catch the first time a post is saved and isn't in disabled mode? I want to send out an email alert to users when a new entry is published, but I want it to be possible to work on it in disabled mode first.

If I use the `entries.onSaveEntry` event, it comes with the a param for isNewEntry, but I can't use this because it's only true the very first time an entry is saved, even if it's saved in disabled status. After that it will always return false.

It wouldn't be difficult to add an additional field to the entry that would track whether or not emails were sent, but I was wondering if there's a more straightforward way to handle it.

**Tags:** entry, events, saveentry

---

## 1 answers

### Answer by username_1 on 2016-07-06. Score: 2

There isn't an "event" that gets fired when an entry goes live, but you should be able to listen to the `onSaveEntry` event, then check the [same criteria](https://craftcms.stackexchange.com/questions/11686/set-status-in-a-plugin/11693#11693) that Craft uses to determine if an entry is live or not.

As far as tracking if it's the first time the entry had a live status or not, it's kind of lame, but your plugin could have a [Record](https://craftcms.com/docs/plugins/records)/table that kept track of the entry ID and status so you'd know if it was the first time an entry ID had a status of Live or not.

> **Comments:**
> **username_0**: Would there be a way to differentiate between the first time it's published live and if it gets saved again, like if a typo needed to be corrected or something?  
> **username_1**: Updated answer.  
> **username_2**: Correct me if I'm wrong... you wouldn't even need a separate Record/table. You could simply have a separate field on the entry, which would get updated once the entry goes live. (A date field would work nicely here.)  
> **username_1**: @LindseyD yup, that should work, too  

---

