Is there a hook that could be used to check what status was before submission, and what status is submitted (changed to) whilst editing an entry?

I want to check to see if a status is changed to 'x2' from 'x1' for example.


1 Answer 1


I would use the


extension hook, and write a mini-extension that looks at the meta array in the api for the entry status value, and compares it to the previous value for that entry (if it exists). Quick example hook function that could work for your situation:

function entry_submission_ready_my_hook($meta, $data, $autosave)
    // get entry_status and entry_id if it exists
    $new_status = $meta['status'];
    $entry_id = $data['entry_id'];

    // check if the entry exists
    $entry = ee()->db->select('status')
                 ->where('entry_id', $entry_id)

    // do we have an entry and is it's status different?
    if ( ( $entry->num_rows() > 0 ) &&
         ( $entry->status !== $new_status ) ) 
        // we have different entry status! do stuff here!

The above code is completely untested, but that's the idea and should work just fine for your needs.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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