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?

1 Answer 1

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

1
  • Cheers @AlecRitson perfect
    – Lettie
    Commented Aug 26, 2015 at 11:36

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.