Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
We have a Webform on our site that collects user information with some file uploads. For our purposes, this information goes stale pretty quickly and we would rather not have the data accumulate forever. Is there a way to setup some pruning of the data to say maybe delete all submitted Webform data/files that are older than one month? Would this require writing a custom module to accomplish this or does something like this already exist? I searched around, but couldn't find anything.
THANKS
Comments
Comment #2
DanChadwick CreditAttribution: DanChadwick commentedI don't know of a module that does this, but you can search. There is a Webform Clear module, which deletes the submission as soon as e-mail(s) are sent. This could maybe be modified to delete all the submissions beyond X using a cron task.
Comment #3
SoCalErich CreditAttribution: SoCalErich commentedPerfect. Yeah it looks like I didn't do quite enough homework first. I actually DID see the Webform Clear module, but according to the description on the project page, it only deletes submissions right after it emails them which is not what I would want. So I decided to download it and see if I could see how it worked and perhaps make my own custom module as you suggested and it turns out that it already HAS the functionality of giving it a time range to delete the submissions. You can delete them immediately , but you can also delete them after 1 day, after 7 days or after 30 days which is exactly what I needed.
THANKS
Comment #5
Gomez_in_the_South CreditAttribution: Gomez_in_the_South commentedJust to document that the Webform Purge module does exactly what the original question asks for Drupal 7 - it allows pruning of webform submissions older than X days on cron.
For Drupal 8, this functionality is built into Webform.