最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - GravityForms Limit Submission Per Time Period by User or IP by 30 minutes?

programmeradmin1浏览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 - /

When looking at the code here - .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 :(

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/better-limit-submission-per-time-period-by-user-or-ip/

When looking at the code here - https://gist.githubusercontent/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 :(

Share Improve this question asked Jun 5, 2015 at 0:20 MikeMike 616 bronze badges 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. – Shaun Cockerill Commented Mar 9, 2022 at 3:53
Add a comment  | 

2 Answers 2

Reset to default 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.

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.

发布评论

评论列表(0)

  1. 暂无评论