Notify Users When They Haven’t Completed a Form

A notification at the top of the members page showing that the form is incomplete.

In my ongoing love for Gravity Forms, I was using the plugin this morning to add some functionality to my WordPress maintenance service, The WP Butler.

When a new member signs up, they’re immediately asked to complete a short form about their site, so that I can get access to it above all else. So if a user completes payment but for some reason doesn’t complete that form, that’s an issue, as they’ll be paying for a service that I can’t perform.

So I wanted to notify them if they hadn’t completed this particular form. The idea was to have a big red box at the top of the Members Area with a warning, referring them to the form so that they could provide the needed information.

Here’s how I did it:

Add a hidden field to the form

I started by taking the form that I had already built and added a checkbox field to it. I left just one option (Yes) and labelled it “Completed this form”. Then I pre-checked the box and set the visibility to “Admin Only”.

Checkbox for completed form

Now, whenever the form is submitted, the user will not see the field, but the response will always be Yes, because we pre-checked the box.

Add value to user profile

Now we want to add a piece of usermeta to the user’s profile, so that there is a permanent record of whether that form was completed for each user. To do this, I used the Gravity Forms User Registration add-on. This requires a developer license, so again I reiterate that you should get a Gravity Forms Developer license.

Create a new feed under Forms > User Registration, select Update User as your action and select the form that you added the checkbox to. At the bottom of the ensuing form is a section called User Meta. For Select Meta Option, choose Add Custom from the bottom of the list and enter a descriptive name in the text field that it brings up. Then select the Yes checkbox in the next dropdown, so that when that box is checked (always), it will be saved against the user’s profile in a field that you just labeled.

This how the settings look when adding the checkbox info to the user profile.

Create a shortcode for notifying user

Now that we’ve got the mechanism for determining whether a user has completed the form, we want to notify them if they haven’t.

Here’s the code that I drew up:

This code starts off by getting the current user’s info from the database. Then it takes the value of the completed_new_member_info field (or whatever you called your field). Then, we use a conditional to say that if the user has not completed the form (the value of the field is not “Yes”), then to return the contents of the shortcode. You’ll notice that I also used the do_shortcode function in doing so, so that I could nest a shortcode inside this shortcode that we’re creating.

Now you have a shortcode that you can put content (including shortcodes) inside, which will only show if the user has not completed the form.

Using the shortcode

I created a section at the top of my Members Area and used Symple Shortcodes to create a red box that would display if the user hadn’t completed the form, using this syntax:

If a user hasn’t completed the form, this is what they’ll see:

A notification at the top of the members page showing that the form is incomplete.

I’ve found this immensely useful, as now I can prominently display that reminder, without annoying people who have already completed the form. I’d be interested to see how other people have used this snippet.

Do this and more with Gravity Forms

4 thoughts on “Notify Users When They Haven’t Completed a Form”

  1. johanbeng says:

    Good tip. This way you do not see that annoying notice if you have actually filled in all information.

  2. Paul Stubbs says:

    I am looking for something similar. I have a jobsite and I wanted to notify jobseekers when they haven’t completed their profile. I.E. When they had actually files in the registration form but hadn’t selected their preferences. I was looking for something that would periodically check and send them an email “You havnt completed your profile” please log into your account and select your preferences.

    Can this form be adapted to do this.

    1. No, you’d need to take a different approach really, with a function that runs on a schedule (using cron) to check for these details and then use wp_mail to send the user an email if that information isn’t complete. However, that could be quite repetitive and frustrating for the user if you ask me.

  3. Paul Stubbs says:

    Thanks Dave.

    I think that’s probably the way i shall go. I take your point about emails all the time could be annoying.

Leave a Reply