In certain places within the plugin, you can add variables to display dynamic data. In some places, a reduced amount of variables are available because the form has not yet been submitted, these are known as Pre-process variables.
Pre-process variables can be used in:
- Field default values
- Field placeholders
- The content for the HTML element
All variables can be used in:
- The subject and content of email notifications
- Recipient fields in email notifications
- The content for confirmation messages
- Confirmation redirect query variables
- Database field values
Pre-process variables
Name | Variable | Example |
---|---|---|
Form URL | {url} | https://example.com/contact |
Referring URL | {referring_url} | https://example.com/ |
Post ID | {post|ID} | 123 |
Post Title | {post|post_title} | Contact Us |
Custom Field | {custom_field|my_custom_field} | (any custom field value) |
Date | {date} | 9/28/2022 |
Time | {time} | 10:00 am |
DateTime | {datetime} | 9/28/2022 10:00 am |
Site Title | {site_title} | My Website |
Site Tagline | {site_tagline} | Just another WordPress site |
Unique ID | {uniqid} | 6334069ec68ec |
IP | {ip} | 123.45.67.89 |
User Agent | {user_agent} | Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36 |
User Display Name | {user|display_name} | Joe Bloggs |
User Email | {user|user_email} | joe@example.com |
User Login | {user|user_login} | joe-bloggs |
User Meta | {user_meta|my_user_meta_key} | (any usermeta value) |
Additional variables after submission
Name | Variable | Example |
---|---|---|
Entry ID | {entry_id} | 456 |
Form Name | {form_name} | Contact form |
All Form Data | {all_form_data} | (HTML table or plain text list, depending on context) |
Element Value | {element|id:3|Email address} | customer@example.com |
Default Email Address | {default_email_address} | info@example.com |
Default Email Name | {default_email_name} | Example Inc. |
Default “From” Email Address | {default_from_email_address} | noreply@example.com |
Default “From” Email Name | {default_from_email_name} | Example Inc. |
Admin Email | {admin_email} | info@example.com |
Parameters
Some variables have additional parameters (modifiers) that affect the value that is returned. Parameters are added by adding a pipe character |
before the closing curly bracket. Multiple parameters can be added by separating them by the pipe character (if the variable supports it).
{post}
The {post}
variable returns a property of the current post. Specify the property key to be returned as the first parameter after the pipe. For example:
{post|ID}
returns the post ID.
{post|post_title}
returns the post title.
{post|post_type}
returns the post type.
Full list of parameters:
ID
post_author
post_date
post_date_gmt
post_content
post_title
post_excerpt
post_status
comment_status
ping_status
post_name
to_ping
pinged
post_modified
post_modified_gmt
post_content_filtered
post_parent
guid
menu_order
post_type
post_mime_type
comment_count
{user}
The {user}
variable returns a property of the currently logged-in user. Specify the property key to be returned as the first parameter after the pipe. For example:
{user|display_name}
returns the logged-in user’s display name.
{user|user_email}
returns the logged-in user’s email address.
{user|user_login}
returns the logged-in user’s username.
Full list of parameters:
ID
user_login
user_nicename
user_email
user_url
user_registered
display_name
{date}, {time} and {datetime}
These variables return the date, time or date & time, in the timezone configured in the WordPress General settings. The format of the date and time is determined by the Locale configured in the Quform plugin settings (or custom PHP date formats, if set). The format can be overridden by specifying a format parameter within the variable. See the WordPress article Formatting Date and Time or the PHP manual for formatting options. For example:
{date|format:Y-m-d}
returns the date in the format YYYY-MM-DD
{time|format:H:i}
returns the time in the 24-hour format HH:MM
{datetime|format:Y-m-d H:i}
returns the date & time in the format YYYY-MM-DD HH:MM
{uniqid}
The {uniqid}
variable has two parameters available: prefix
which will add a prefix to the unique ID, and moreEntropy
which will add additional characters at the end of the value which increases the likelihood that the result will be unique. For example:
{uniqid|prefix:ABC-}
will result in a value like ABC-63355fe687761
{uniqid|moreEntropy:true}
will result in a value like 6335600ab466b3.77060553
{uniqid|prefix:ABC-|moreEntropy:true}
will result in a value like ABC-633560ad273135.50160175
{all_form_data}
The {all_form_data}
variable has one parameter available: showEmptyFields
which will show fields that are empty (by default, these are hidden). For example:
{all_form_data|showEmptyFields:true}
{element}
The {element}
usually structured like {element|id:3|Label}
variable has three parameters available:
id
specifies the ID of the element to get the value of, it’s the last number of the element unique ID, this attribute can be further modified to get array values if the value is an array (see below)format
specifies whether to get the value in HTML or plain text formatseparator
specifies the separator for plain text array values (like checkboxes)
Note: the “Label” in the above example is technically a parameter too, but it is ignored. It’s just there to help you keep track of which variable is for which element.
Examples:
{element|id:3|Label}
gets the value for element ID 3.
{element|id:4|format:text|Another label}
gets the value for element ID 4 in plain text format.
{element|id:5|format:text|separator:;|A checkbox label}
gets the value for element ID 5 in plain text format, this could be a checkbox where the values will then be separated by a semi-colon.
Some field values are an array (for example Checkboxes, File Uploads and the Name field), see the Data Types table for more information. With the id
parameter, you can use dot notation to select specific values within those arrays.
After the numeric ID, add a dot (period) and then the key of the array element that you want to access. For example:
{element|id:6.0|A checkbox}
will get the value of the first selected checkbox of a Checkbox field.
{element|id:7.0.name|A file upload}
will get the filename of the first uploaded file of a File Upload field.
{element|id:8.4|A name}
will get the last name value of a Name field.