Deletion deadlines of contact requests
This tutorial will show you how to set up deadlines to delete contact requests of an entry automaticaly after the deadline is reached.
If you haven't already done it, install and setup your project. You can use the umkickstarter.
Continue with creating a new Contact Form instance.
Enable deletion deadlines
Go to Tools/Apps/Contact Form and edit the new instance:
Go to settings and select Automatically delete contact requests after deadline
You can choose between the options Delete contact requests after deadline and Delete fixed date contact requests.
While the first option ensures that the request is deleted in x days, weeks, months or years, the second ensures that requests with this time stamp will be deleted when this timestamp has already been reached.
For our purpose, select Delete fixed date contact requests and enter today's date and the current time. |
Send a contact request
Call the contact form in your web browser and send some dummy contact requests.
This will create a new table row in the contacts table of a (n new) entry. Among other things, the attribute Deletion date ist set to the timestamp set up in the Contact Form instance.
Run Job to clean up tables
Go to Tools/Jobs and display the ContactForm 2 Cleanup Tables job through the eye symbol.
Usually this job should run automatically. In this case you would like to see some results immediately, so click on Run now to run it and open the output.log after the job is finished.
The log should look something like this.
It shows all contact requests which were made before the deadline Deletion date (you set up in Step 1) run out of date.
Later on, you may need to check up this process for some reason. All deletions are although logged into the HistoryLog. Go to Tools/History Log.
Fill out the search form and run it by clicking the loop-Button:
Search → contactform2-cleanup-tables All areas → Jobs All actions → Execute | All areas → EditUser Actions → Delete |
Open the details view to see the log file of this job. | It may be possible that a user was deleted as well while running this job. Look for User Job contactform2-cleanup-tables. |