I have a database which contains user posts.
Users have the option to delete posts however instead of confirming deletion, I would like to have an undo option which when clicked restores the post. If the user refreshes the page or leaves the page the undo option disappears.
With the current solution, the database deletes the post as soon as the user presses the confirm button. However I'm guessing I would have to keep the post after it is deleted so that it can be restored with the undo option however when and how would I go about deleting the post?
Edit:
Is there a way to schedule deletions, say 24 hours after the user deleted? I know I could use cron, however with many users, this would take a lot of cron jobs.
Thanks.