0

Is there a way to disable a freeform form if a user has already submitted their details? There is a plugin that can pull the users IP but how do I compare to that to the list of IP addresses of submitted freeform entries?

{if "{exp:get_post_var type='user_ip'}" == "127.0.0.1"}
    YES, it is 127.0.0.1
{if:else}
    NO, it is not 127.0.0.1
{/if} 

2 Answers 2

3

Freeform has built in duplicate detection. https://solspace.com/legacy_docs/freeform-4/form/#prevent_duplicate_on

0

You could check if an entry with a certain ip address is submitted with the entries function:

{exp:freeform:entries search:ip_address="127.0.0.1" form_id="your-form-id" dynamic="off" limit='1'}
{if freeform:no_results}
No, 127.0.0.1 has not submitted an entry
{/if}

Yes, 127.0.0.1 has submitted an entry
{/exp:freeform:entries}
6
  • Thanks that does work, just trying to figure out how to pull the variable into ip address search like this {exp:freeform:entries search:ip_address="{exp:get_post_var type='user_ip'}"
    – Thomas K
    May 24, 2016 at 13:13
  • I'm kinda guessing that you want to do a check against the users ip address before even presenting them the form? Does this, {exp:get_post_var type='user_ip'}, return what you're expecting when you display it on the screen? Turn on template debugging and check that the correct value is being inserted into the tag.
    – Jim Wyse
    May 24, 2016 at 14:16
  • Hi Jim, outside the tag {exp:get_post_var type='user_ip'} shows the IP address. When placed inside the tag it's showing random text... {exp:freeform:entries search:ip_address="M60o93H7pQ09L8X1t49cHY01Z5j4TT91fGfr" form_id="12" dynamic="off" limit='1'}
    – Thomas K
    May 24, 2016 at 18:32
  • The duplicate detection like Jim Wyse answered is a better and easier solution. May 25, 2016 at 8:07
  • I would like to hide the form before it is being presented, so I want to check the IP address against the freeform entries as they land on the site. If they have submitted an entry it will hide the popup form displayed so they don't get prompted everytime they visit the homepage. @JimWyse, do you have any suggestions?
    – Thomas K
    Jun 4, 2016 at 11:34

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.