1. Home
  2. Knowledge Base
  3. HappyPress
  4. How to require data capture before viewing a post

How to require data capture before viewing a post

You may wish to restrict access to a post to only those who have completed a data capture form. A practical example can be found on the SMILE website. We publish roundups from our webinars which include a recording, slides, links, questions etc. But we require that you be signed up to our mailing list in order to access it.

This article will show you how to do similar.

This approach requires the use of cookies



  1. Create a form that you want users to fill out in order to access your post. Make a note of the form ID. You can find this in the list of forms.
  2. Create and publish a page with your form added in the main body. We will redirect users to this page if they have not filled out the form before. Make a note of the URL to this page.

Restricting access

  1. Add the following custom fields to the post you wish to restrict…
    1. Name: gwsa_require_submission
      Value: 1
    2. Name: gwsa_form_ids
      Value: Set this to the form ID that you require the user to have completed in order to access this post. If you require multiple forms, simply add a comma separated list of values (Example: 1,2,3)
    3. Name: bypass_cache
      Value: true
      This sends the post data via AJAX, in order to avoid the cache. Note: this does not always work – especially on HappyPress. There is an optional tip at the end of this list which will ensure you bypass the cache.
    4. Name: gwsa_requires_submission_redirect
      Value: The URL to the page where your form is hosted

      Don’t do this, as it damages your RSS feed!
  2. OPTIONAL (recommended for HappyPress subscribers): Add a redirect under Tools > Redirection for the post you have restricted access to.
    1. Source URL: The URL to the post you wish to access
    2. Query Parameters: Exact match in any order
    3. Target URL: The URL to the post you wish to access, appended by /?subscribers-only
      1. In truth, any query parameter here is fine. We like this one because its semantically obvious for newcomers to understand. But all this is doing is hitting a rule in HappyPress that means the page will not be server-side cached. As a result, this technique is not great for posts that may have very high numbers of concurrent users.

Now your users will be redirected to the form if they have not previously filled it out. When they do, a cookie will be added to their device so that they do not get redirected again in the future. They will then be able to access the post.

For more options in the Gravity Forms Submit to Access plugin, please visit the Gravity Perks website.

Updated on October 22, 2021

Was this article helpful?

Related Articles

Not the solution you were looking for?
Can’t find the answer you’re looking for? Don’t worry we’re here to help!
Contact Support