Gform_incomplete_submissions_expiration_days questions

I have a form that is used for a contest. I have a set expiration date for when people are able to submit the form.

What I don’t quite understand is how gform_incomplete_submissions_expiration_days works. Is the date set per submission? So if someone starts a form today, but the contest is open for another 3 months, can I set that filter to return 90? But will that number affect all form submissions or just that one? Tomorrow, if someone submitted a form, that number would be 89, for example.

Can I use gform_incomplete_submissions_expiration_days like that? Calculate how many days left for the contest to close, and then set the number to that?

Thanks

gform_incomplete_submissions_expiration_days is related to Gravity Forms Save and Continue feature, and controls when an individual draft entry will be purged.

From what you’ve explained, you will want to enable the Schedule Form setting and set an expiration date/time to match your contest’s end. This feature will prevent form submissions once the end date/time is reached.

Hi Alicia,

If what you’re trying to do is to ensure that partially completed entries, expire when the contest ends, then you can use the gform_incomplete_submissions_expiration_days filter to do that. Below is a code that you can use a starting point;

add_filter( ‘gform_incomplete_submissions_expiration_days’, function ( $expiration_days ) {
        $contest_end = strtotime( '2025-10-31' );  // Update this to the contest end date.
        $now = time();
        $diff_in_days = ceil( ( $contest_end - $now ) / 86400 );
        return max( 0, $diff_in_days );
});

I hope this helps.

Best,

Thanks. But what we want is for the forms that are in progress to have a couple of extra weeks to complete after the contest end. And we want all pending forms to be discarded at the same time.

1 Like

Thanks. That’s exactly what I was planning on doing. I was just wondering if it would work, I mean, having all the same expiration date.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.