<p>There's not an easy way.</p>

<p>As the related to link mentions, there isn't an event or anything that Craft fires when a future post dated entry goes live because the way Craft decides if an entry is "live" or not is if it is enabled (both on a per-locale and global basis), it has a post date in the past and an expiration date that doesn't exist or hasn't been met yet.</p>

<p>There's no actual PHP code that executes when that current time actually passes the post date time.</p>

<p>One semi-hacky way to get around it would be to setup a cronjob that hit a controller action every minute in a custom plugin that and plugin would keep a record of every entry's post date (via the onSaveEntry) event.</p>

<p>That controller action would check the current date/time against its internal record of entry post dates and you could fire off an email for any entries when the post date has passed.</p>

CC BY-SA 3.0
2016-10-13T12:56:57.007Z
Thanks Brad! This will get me going in the right direction.
Rob McFadden
CC BY-SA 3.0
2016-10-12T21:20:54.510Z
2016-10-12T21:20:54.510Z
Brad Bell
<p>I've created a plugin called <a href="https://superbig.co/plugins/published-event" rel="nofollow noreferrer">Published Event</a> does exactly what Brad suggests in his answer. It fires off an event when a entry moves from pending to live.</p>

CC BY-SA 3.0
2017-03-10T17:41:13.650Z
2017-03-10T17:41:13.650Z
Fred Carlsen
<p>Is there a way I can run some code from a plugin when a future dated entry goes 'live' from 'pending'? I am trying to send an email update that a new entry has been posted. The related post below helped me with this, but it doesn't seem to cover future dated entries.</p>

<p>Here's what I have so far...</p>

<pre><code>craft()-&gt;on('entries.onBeforeSaveEntry', function(Event $event) {
    $entry = $event-&gt;params['entry'];

    if ($entry-&gt;section-&gt;handle !== 'blog') {
        return;
    }
    if ($entry-&gt;status !== 'live') {
        return;
    }

    if (!$entry-&gt;getContent()-&gt;emailSent) {
        // send email
    }

    $entry-&gt;setContentFromPost(array('emailSent' =&gt; true));
});
</code></pre>

<p>Related to: <a href="https://craftcms.stackexchange.com/questions/15825/checking-for-first-time-an-entry-is-published-i-e-saved-with-a-live-status">Checking for first time an entry is &quot;published&quot; i.e. saved with a Live status</a></p>

<p>Thanks!</p>

<plugin-development><entries><events>
Fire event first time future dated entry goes 'live' from 'pending'
# Fire event first time future dated entry goes 'live' from 'pending'

(Asked by: username_0 on 2016-10-12)

Is there a way I can run some code from a plugin when a future dated entry goes 'live' from 'pending'? I am trying to send an email update that a new entry has been posted. The related post below helped me with this, but it doesn't seem to cover future dated entries.
Here's what I have so far...
craft()->on('entries.onBeforeSaveEntry', function(Event $event) {
    $entry = $event->params['entry'];

    if ($entry->section->handle !== 'blog') {
        return;
    }
    if ($entry->status !== 'live') {
        return;
    }

    if (!$entry->getContent()->emailSent) {
        // send email
    }

    $entry->setContentFromPost(array('emailSent' => true));
});

Related to: Checking for first time an entry is "published" i.e. saved with a Live status
Thanks!

**Tags:** plugin-development, entries, events

---

## 2 answers

### Answer by username_1 on 2016-10-12. Score: 3 | Accepted answer

There's not an easy way.

As the related to link mentions, there isn't an event or anything that Craft fires when a future post dated entry goes live because the way Craft decides if an entry is "live" or not is if it is enabled (both on a per-locale and global basis), it has a post date in the past and an expiration date that doesn't exist or hasn't been met yet.

There's no actual PHP code that executes when that current time actually passes the post date time.

One semi-hacky way to get around it would be to setup a cronjob that hit a controller action every minute in a custom plugin that and plugin would keep a record of every entry's post date (via the onSaveEntry) event.

That controller action would check the current date/time against its internal record of entry post dates and you could fire off an email for any entries when the post date has passed.

> **Comments:**
> **username_0**: Thanks Brad! This will get me going in the right direction.  

---

### Answer by username_2 on 2017-03-10. Score: 3

I've created a plugin called [Published Event](https://superbig.co/plugins/published-event) does exactly what Brad suggests in his answer. It fires off an event when a entry moves from pending to live.


---

