Shack Forms has a "Variables" feature that allows you to customize the emails sent from your forms.
This guide will show where you can use variables and which variables you can use.
Where to use Variables
There are two tabs inside Shack Forms where you can enter variables:
- The "Email" tab
- The "Email Template" tab.
The following fields inside the "Email" tab cannot accept shortcodes:
- Email From
- Email To (will accept multiple valid email addresses separated by commas)
- Mail to list
- Email BCC
- Reply to Email.
These fields accept only valid email addresses.
In the image below, the {username} variable field will be replaced by the logged-in user's username.
The second place you can enter variables is the "Email Template" tab. You can choose "Custom Text Message" and enter your variables. Click here to read more about customizing emails.
What Variables can you use?
Inside Shack Forms, a list of variables will be next to your fields. You can think of these variables as being in several groups.
The first and most important group of variables allows you to show information entered into the form. Here are some examples:
{field_alias.value}
- This displays the data from a particular field. All you need to do is replace "alias" with the alias from your field. You can find the aliases inside each field. For example, you can load the data from this field using{name.value}
:
{field_alias.label}
- This displays the visual label from a particular field. All you need to do is replace "alias" with the alias from your label. In this case, you use the{name.label}
field to show "Your Name" in the message.{files}
- This links to uploaded files if "Attachment type" is set to "Links to files".{lang:MOD_PWEBCONTACT_XXXX}
- This will load a translation from ShackForms. For example, you can load the title of this field by using{lang:MOD_PWEBCONTACT_EMAIL}
code>{name}
- This comes from the default "Name" field.{email}
- This comes from the default "Email" field.
Some variables can also collect background information on the user. This is particularly useful for collecting technical information such as bug reports.
{sent_on}
- Date and time.{ip_address}
- User IP address.{browser}
- User browser name.{os}
- User operating system name.{user_agent}
- The user agent string from the browser.{screen_resolution}
- The user's screen resolution.
Some variables can collect information from the page where the user enters data into Shack Forms.
{title}
- The page title of the URL where the user submitted the form.{url}
- The URL where the user submitted the form.{site_name}
- The name of the site as set in Global Configuration.
Finally, some variables work if the user is logged in. For example, you can automatically fill in data from their Joomla user profile:
{username}
- The Joomla's user's Username.