0

I am following this DIY code by GravityWiz but the author doesn't mention how to make the code work with 30 minutes, 1 hour, 2 hours, etc...? He only explains how to make it work with 24 hours - http://gravitywiz.com/better-limit-submission-per-time-period-by-user-or-ip/

When looking at the code here - https://gist.githubusercontent.com/spivurno/4024361/raw/gw-gravity-forms-submission-limit.php

Does this mean I make the functions:

# Basic Usage
new GW_Submission_Limit( array(
    'form_id' => 86,
    'limit' => 1,
    'time_period' => '60',
    'limit_message' => 'Aha! You have been limited for 60 minutes!.'
) );

Would this be the right way to do it? I posted a comment on their site but never got an answer, which was a few days ago :(

1
  • I found the GravityWiz post linked above clearly indicates how to use the time_period parameter. 1 Minute: 'time_period' => 60, 30 Minutes: 'time_period' => 30 * 60, 1 hour: 'time_period' => 60 * 60, 2 hours: 'time_period' => 2 * 60 * 20. Commented Mar 9, 2022 at 3:53

2 Answers 2

1

I've updated the article with more detailed instructions on the time_period usage. For others having the same question here:

The period of time to which the limit applies. The default time period is one day. In any 24 hour period, if the user reaches the limit they will no longer be able to make new submissions.

If you want to limit by less than a day, you can provide the time period in seconds. A time period of 60 would be one minute (60 seconds). A time period of 60 * 60 (or 3600) would be one hour.

Also supported are three different calendar periods: per_day, per_month, per_year. Calendar time periods are more rigid time periods that “reset” when the calendar time period expires (i.e. one month ends and another begins).

If you do not want to limit by a time period at all, set the time period to false.

0
0

The period of time to which the limit applies. The default time period is one day. In any 24 hour period, if the user reaches the limit they will no longer be able to make new submissions.

If you want to limit by less than a day, you can provide the time period in seconds. A time period of 60 would be one minute (60 seconds). A time period of 60 * 60 (or 3600) would be one hour.

1
  • Hello, this answer doesn't appear to be any different than the previously posted answer. Could you edit your answer and clarify how your answer is any different than the previous, maybe provide more information?
    – Howdy_McGee
    Commented Sep 3, 2019 at 16:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.