Q:

How do I check if a field value has changed in a entry_submission_ready hook handler?

I am writing an extension for the hook
entry_submission_ready

I see that it has 3 params(meta, data, autosave).
I look at data and I see there is channel data in there and a revision post data index.
I assumed that the revision post data contains the old, not updated data.
But when I compared then to the top level data, they are the same. Both also show the updated data.
Is there any way I can access the old data? Do I need to use a different hook?
How do I know if a field value has been changed by edits?

A:

That hook gives you all the data you need to query the database. $meta will hold your entry_id, channel_id, title, etc (anything that goes in exp_channel_titles), and $data holds your custom field data.
So just as an example:
if(!empty($meta['entry_id']))
{
    $current = $this->EE->db->query("
        SELECT * FROM exp_channel_data WHERE entry_id = {$meta['entry_id']} LIMIT 1
    ");
    if($current->num_rows() == 1)
    {
        if($data['field_id_1'] === $current->row('field_id_1'))
        {
            // Data has not changed in field_id_1
         }
    }
}

