Only insert record if last update was less than a minute ago

I have an activity feed in the admin area of a site I have built which shows actions by each user as they happen in real time.

One possibe action is photo uploads, but I want to limit the number of feed items created so wondered if there was a way to only run the insert code if the last update to a table was less than one minute ago?

1 Like

So just too clarify, when something happens on your site by a user you create an activity feed item within the admin area that says what action they have just performed.

Sort of like:
"{user} has just changed their email address"

And if a user uploads a photo and say changes an email at the same time you want something like:
"{user} has just changed their email address, they also uploaded a new photo"

Instead of:
"{user} has just changed their email address"
"{user} has just uploaded a new photo"

EDIT: Just a couple of questions

If a user uploads a new photo and then says 2 minutes later changes there email do you want to combine them changes?
Or do you only want to combine them changes if they’re done within the same request?

Depending on your answer will depend on how to approach this :slight_smile:

Yes, I want changes made within a short period of time combined so the feed doesn’t become cluttered with the same type of updates.

No, over a set period they should be combined.