Photo by Jamie Street

Gravity Forms HTTP Referrer Redirect

Today I setup up a simple form flow in Gravity Forms. Originally I had user registration divided up in three different forms. Obviously this was not ideal; having the same process in multiple places would make maintenance more time consuming.

What I did instead was concoct a really simple flow. Honestly I’m kicking myself for not thinking of this early, but given how the project has unfolded it’s not entirely surprising. The first thing was to create a hidden field on the form that captures the HTTP referrer.

The drop down on the right is where you select it, or you can just input the tag manually.

And voila! There it is, populated in the form as a value of the hidden field.

Yep, there it is, right there.

From there I started setting up conditional confirmation based off the referrer value.

Now the registration form will redirect to the correct form after the user registers! Since email activation was not required by the client the only thing left is to skip the registration form if the user is already logged in, which can be done using one of the gravity form pre_render hook.