1

I have created an extension to manipulate saved data when an entry is saved. I can't get this to work using entry_submission hooks, I cannot find that much information about this online. I believe I need to use entry_submission_ready.

Does anyone know why this does not work when I save an entry?

function entry_submission_ready($entry_id, $meta, $data)
{
    $data['field_id_123'] = 'Test';

    if(isset($this->EE->api_sc_channel_entries))
    {
        $this->EE->api_sc_channel_entries->data = $data;                    
    }
    else
    {
        $this->EE->api_channel_entries->data = $data;
    }
}

The hook IS being called because I can output $data to the screen (print_r) and can see the value of the field I have set in the $data array. But this is not saved to the entry.

I have also tried $this->EE->api_channel_entries->data['revision_post'] and entry_submission_ready. None work.

EE 2.7.2

Thanks

1 Answer 1

5

I got it working.... silly, silly, silly me....

Initially I used entry_submission_end($entry_id, $meta, $data), but realised I needed entry_submission_ready.

I overlooked the fact entry_submission_ready uses different arguments, its ($meta, $data, $autosave) and not ($entry_id, $meta, $data)!

Now it works fine with the correct arguments. RTFM!

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.