PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

How to check if form has been submitted, but on other page?

  1. I've created a form with "Terms of Use" agreement at my WordPress site. If user agree - it's redirecting to other page. But now I need to check on the other pages - if user submitted this form - it's OK, if not - user should be redirected to the page with "Terms of Use" again.

    What PHP construction I can use?
    I need something like "If entry of the formid=X exists for userid=Y, then do nothing. Else - redirect to the page Z."

    Please help. Thank you.

    Posted 11 years ago on Wednesday March 13, 2013 | Permalink
  2. I would store something in the usermeta for that user which indicates that they already agreed to your terms of use. You will need to make sure the user is registered, then you can use the gform_after_submission to update that user's meta (or if you are registering the user, you can store it automatically at that time using the User Registration add-on). Here is the documentation for the gform_after_submission hook: http://www.gravityhelp.com/documentation/page/Gform_after_submission

    Then, on pages where you need to verify if they agreed to your terms or not, you will need to check the usermeta for the logged in user to see if it exists. If so, then show them the content.

    Posted 11 years ago on Thursday March 14, 2013 | Permalink
  3. OK, thx!
    That's not really easy to use in case if I'll need to drop all the flags about accepted Terms if I'll change them... I thought there will be some tag/function, which I could use without grabbing data from DB or using personal User meta...
    I think I'll use cookies then, but thanks for advice!

    Posted 11 years ago on Thursday March 14, 2013 | Permalink
  4. Cookies is another way to do it. I hope you can find a work-around you're happy with.

    Posted 11 years ago on Thursday March 14, 2013 | Permalink