Hi all,
I need to write an extension that sends a notification e-mail out when an entry gets updated, but I can’t seem to find a hook that gets called when the publish form is submitted.
Am I just blind or what?
There is no separate update function.
New entries as well as updates are both handled by the function submit_new_entry() in cp.publish.php and the hook you are looking for will probably be “submit_new_entry_start” or “submit_new_entry_end”.
Whether it is an update you are dealing with you’ll have to figure out yourself.
If it is a new entry the $data-array contains the key-/value-pair ‘entry_id’ => ”. If it is an update that key is missing.
So if you take the ‘submit_new_entry_end’ hook something like this should point you into the right direction:
if ( array_key_exists("entry_id", $data) )
{
//It's a new entry
}
else
{
//It's an update
}
I finally got around to releasing this extension today:
http://ellislab.com/forums/viewthread/76075/
Thanks for your help, silenz!
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.