Event when an entry is enabled I've been looking for an event that get triggered when an entry is moved from a disabled to enabled status.

Currently I'm trying to find it through the EVENT_AFTER_SAVE_ELEMENT event but I have no idea what the previous status of the entry was so I can't tell if it was just updated:

current

Event::on(
    Elements::class,
    Elements::EVENT_AFTER_SAVE_ELEMENT,
    function(Event $event)
    {
        $element = $event-&gt;element;

        // Get the status, but I don't know the previous status.
        $status = $element-&gt;status;
    }
);


I also had this pointed out to me https://docs.craftcms.com/api/v3/craft-events-setstatusevent.html but I don't know what emits this event as a parameter.
Well, that's awkward.

The SetStatusEvent was removed way back in the Craft 3.0 launch, but the class itself was never removed (will fix that for the upcoming 3.4 launch).

There isn't really a clean replacement for it.

One way would be to listen to the EVENT_BEFORE_SAVE_ELEMENT event, run a separate database query to get the current status from the database and compare the status to the element that was passed in to see if it changed.

3.4 will give you another option - you could listen to EVENT_AFTER_SAVE_ELEMENT, then check the dirtyAttributes array to see if the status has changed, since elements now keep track of what attributes have changed on a given request.