How it works
Weight Tracker, can examine Gravity Form submissions for relevant Weight and Measurement data. If valid data is found, a weight entry will automatically be created for the user currently logged in. This allows you to mix Weight Tracker fields amongst your Gravity Forms to provide a more tailored experience.
So, how does it work? If enabled, it examines every Gravity Form submission for fields that have certain CSS classes. If a field has one of the Weight Tracker classes, it is further examined and validated. If the data looks good as a whole, then a weight and measurement entry is added for the given date.
By default, Weight Tracker will not process Gravity Forms. To enable this functionality, from your WP Dashboard navigate to Weight Tracker > Settings. From the tab “3rd Party” ensure “Enable Gravity Forms” is set to Yes. Then Save.
For example, say you wish to have a form with fields for Pounds, Date and Notes. Create a Gravity form with a numeric field and under the Appearance tab, add the CSS Class “wlt-pounds”. Next, add a date picker field and assign the CSS class “wlt-date”. Finally, add a text area for notes and add the CSS class wlt-notes.
When the form is submitted, if a numeric value has been entered for pounds (or other relevant weight fields) and a valid date specified then a Weight Entry will be added.
If other fields have a Weight Tracker CSS name and contain valid data, then their data will be attached to the new weight entry.
|CSS class name||Mandatory||Related Weight Tracker field|
|wlt-kg||Yes (or other weight field)||For Kg entry (other weight fields are not needed)|
|wlt-stones||Yes (or other weight field)||For Stones and Pounds (must be used alongside wlt-pounds)|
|wlt-pounds||Yes (or other weight field)||For Stones (wlt-stones must be used on same form) and Pounds or it can be used alone.|
|wlt-bust-chest||No||Bust / Chest|
|wlt-photo||No||This should be applied to a Gravity Form file upload field. IF a photo is uploaded, it will assign it to the weight entry.|
If you are finding that weight entries aren’t being created, please turn on Gravity Forms debugging ( Forms > Settings > Logging ) and re-submit the form. Once submitted, refresh the settings page and click View Log. From here, you should see messages from the Weight Tracker plugin. Hopefully one of these messages will help you to understand why the weight entry was rejected.
Gravity Forms example
The following JSON file is an example form that you can import into Gravity Forms. Simply save the file to your computer as example.json and use the Gravity Forms import tool to import it into it WordPress.