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.
ExpressionEngine® Answers is a question and answer site for administrators, end users, developers and designers for ExpressionEngine® CMS. It only takes a minute to sign up.
Sign up to join this communityIt'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/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).