Closed (duplicate)
Project:
Webform
Version:
5.x-2.2
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
28 Oct 2008 at 17:47 UTC
Updated:
21 Dec 2009 at 10:05 UTC
I needed to get the webform to let a user submit the form each day, no matter what time of day they were submitting it.
The way it works now, the user has to wait 24 hours from their last submission.
I remedied this by declaring a variable like this:
$offset = (date("H") * 60 * 60);
$offset += (date("i") * 60);
then replacing:
$result = db_query($query, $user->uid, $_SERVER['REMOTE_ADDR'], $user->uid, ($node->webform['submit_interval'] != -1) ? time() - $node->webform['submit_interval'] : $node->webform['submit_interval'], $node->nid);
with:
$result = db_query($query, $user->uid, $_SERVER['REMOTE_ADDR'], $user->uid, ($node->webform['submit_interval'] != -1) ? time() - $node->webform['submit_interval'] + $offset : $node->webform['submit_interval'] + $offset, $node->nid);
and :
if ($timestamp <= time() - $node->webform['submit_interval']) {
with:
if ($timestamp <= time() - $node->webform['submit_interval'] + $offset) {
Not sure if this is the best way, but it seems to work.
Comments
Comment #1
quicksketchThanks for the changes! I'd really like to add this as the default functionality of Webform, but working from the descriptions provided is a bit troublesome. Could you create a patch (http://drupal.org/patch/create) and I'll review it for inclusion in Webform?
Comment #2
betz commentedi need this also, but for d6.
I will have a look for it
Comment #3
betz commentedlooks like everything changed since then.
This code is not applicable
Comment #4
quicksketchLet's follow the patch posted in #597438: Limit submission by Calendar Week and Month.