0

Should it be possible to send a notification in mx notify control if the status of an entry changes from x to y?

I can get it to send if an entry with status x is updated but I only want it to send when the status specifically changes from x to y.

0

It's a simple addon, if you don't see that option, it's probably not built in.

Quickest solution would be to roll a quick extension and hook it to the entry_submission_ready hook. Then check statuses, and use the email class to shoot out an email.

https://ellislab.com/expressionengine/user-guide/development/extension_hooks/api/channel_entries/index.html#entry-submission-ready

https://ellislab.com/expressionengine/user-guide/development/usage/email.html

Something simple like:

function my_extension_entry_submission_ready($meta, $data, $autosave)
{
    // submitted updated status
    $status_new = $meta["status"];

    // get previous status
    $status_old = ee()->db->select('status')
                          ->from('channel_titles')
                          ->where('entry_id', $meta['entry_id'])
                          ->get()->row_array();

    $status_old = $status_old['status'];

    // do we meet your conditions?
    if ($status_old == "desired_old_status" &&
        $status_new == "desired_new_status")
    {
        // send email using the email class        
    }
}

Not sure if that hook hits new submissions (which wouldn't have an entry_id), so you'll have to play around to get it right (a few extra conditionals so you can bail if it's a new entry).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.