2

I have a plugin using the onBeforeSaveEntry event. Is there a simple way to check if the entry being saved is a brand new entry i.e. Add New Entry or if it currently exists and is just being updated?

4

You should be able to check for this like so:

if($params['isNewEntry'])
{
 // The entry is new
{
else
{
 // The entry is being updated
{

See here in the docs: http://buildwithcraft.com/docs/plugins/events-reference#entries-onBeforeSaveEntry

  • Cheers @AlecRitson perfect – Lettie Aug 26 '15 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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