Hello,
I search how to or how can i do for users can only view/submit on time with each forms of my site ?
Thanks in advance for your help.
Hello,
I search how to or how can i do for users can only view/submit on time with each forms of my site ?
Thanks in advance for your help.
There is no built in way to limit entries per user, only form wide. This could be implemented, however it would take a customization using PHP and available hooks to do so.
Thank you for your quick respons.
Could you give me some ways to simplement it ? Like files names and functions to modify ?
Just realized a simple way you could implement this.
Edit your form and then edit the Email field. Under the "Rules" area check the "No duplicates" checkbox. This will now enforce a no duplicates rule for that Email field meaning only one entry per email address will be allowed.
You can then go to the Advanced tab for that same field and enter a custom validation message that will be shown as an error if they try to enter twice.
By adding that "No duplicates" rule to that field you make it so only one entry will be allowed with that email address which should accomplish what you want to do.
I think that could make my case, but is it possible to hide the email field ?
Edit :
I prefer that the user just see the thanks message directly instead of the form if the couple email/form id already exist (email field is a hidden field with a default value {user:user_email})
Well, i find a way. I use the limit of entries, setting to 1 for the form, and i have modify the code like this :
In gravityforms/form_display.php
Search :
//If form has a limit of entries, check current entry count if($form["limitEntries"]) {
Add after :
global $user_login; get_currentuserinfo();
Search :
$entry_count = RGFormsModel::get_lead_count($form_id, '');
Replace by :
$entry_count = RGFormsModel::get_lead_count($form_id, $user_login);
Et voilĂ !
This solution work only with registered users, but it is my case, i use Members plugin to limit access of the form to registered users.
I forget to say that you need to have in the form a hidden field with variable user_id ^^
This code worked awesome! Thank you Marsius, it has helped me tremendous.
Many thanks Marsius. Was struggling with this forever.
Hmm this isn't working for me. What exactly do you need to put in the hidden field? I have tried putting user_id in the default value: insert variable field but this doesn't work for me.
Hi Dave,
Here is an alternate solution that doesn't require any core modifications. Paste the following in your functions.php and update the the '28' in 'gform_pre_render_28' to the ID of your own form and should be good to go.
Thanks David, that works ... but ... I am using this on an intranet and everyone has the same IP. Is there a way to do this simply using a cookie?
Thanks i need it too and would use the David's great solution, but if i would set the limit to allow 1 submission per day? Next day the users should be able to use the form again.
Simone
simbian, please post a new topic for your issue. A lot of things have changed in the past 8 months.