There are multiple reasons that you might want users to submit information to your site. For example, if you run a job listing site, you might want to allow users to submit jobs that they are hiring for. Rather than having them send you a generic email however, you can quite easily have Gravity Forms do the heavy lifting for you.
The kind of information that you might want to allow users to submit are endless, but some ideas that come to mind are:
- Job listings
- Items for sale
- Gig listings
Whatever the case may be, you can gather all of the information you want from the user and have Gravity Forms put all of the information in the correct spot so that you can either immediately publish the information, or review it and then publish it once you’re happy with it.
First, you need to understand how your site functions and how it displays the data that you’re interested in. When done properly, most of the options above would use a custom post type to tailor how the information is displayed on your site. So instead of using the default post type (which is a ‘post’), there may be a post type called ‘events’ that your plugin or theme has registered, so that you can publish events on your site.
Then, it is highly likely that each post type saves the information in special fields, which have a meta_key associated with them, which is to say that the post type ‘events’ may have meta_keys for ‘start-date’, ‘end-date’ and ‘location’. These meta values can then be displayed in an appropriate manner in your theme by calling on each individual piece of information.
Now that you have a handle on that, you’re ready to start receiving the information from the users.
Now you can build the form that you’re going to use to collect information from your users. Use the Post Fields to add fields for the appropriate pieces of information that you need to collect. When you insert the Title field, you’ll be able to select which post type the data should be applied to.
The remainder of the Post fields will allow you to save the rest of the information. If you need to save meta information, use the Custom Field option. From there, you can specify what meta key the field applies to, as well as choosing the field type most suited to the data being captured. So, if you’re capturing the start date of the event and you know that the meta_key for that information is start-date, your field might look like this:
It will take some investigation to determine the correct meta_key for each piece of information, though the drop-down list of existing custom fields (meta_keys) may help you to determine the correct one without having to look at any code (for example, if there’s an existing custom field called event_start_date, you might assume that this will be for the event start date.
You can build out your form to collect all of the information you need, and then you can use the Post Status option in the Title field to decide whether to immediately publish the post, save it as a draft, or save it for your review prior to publishing.
Of course, being that this is all done in Gravity Forms, you can take it infinitely further, using notifications and confirmations to let the user and the site admin know when a submission has been received, to accept payment for submissions (or certain types of submissions using conditional logic, such as “Featured listings”) or to have a user account created for the user when they submit the information: the possibilities are endless. Just one more reason to love Gravity Forms!