Shack Forms is one of the most popular extensions here at Joomlashack.
In fact, it's one of the 20 most popular extensions in Joomla. So over the next few weeks, we're rolling out some key improvements to Shack Forms.
This week, we've improved the way that variables work in Shack Forms. What are variables? They give you the power to customize the emails you receive from Shack Forms.
Video on using Variables with Shack Forms
This video comes from the Joomalshack YouTube channel and is a quick overview of variables:
Where can you use Variables?
There are two tabs inside Shack Forms where you can enter variables. First is the "Email" tab.
Inside the "Email" tab, you can use variables related to email addresses. Almost all of the fields on this page are related to email addresses, so we recommend you insert email data. This image below has a typical example: if a Joomla user is logged in, Shack Forms will automatically insert their email address into the "Email from" field.
The one exception on the "Email" tab is the "Email subject" field. You can insert any variable into this field. In the image, below the {username} field will be replaced by the username of the logged-in user.
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, there will be a list of variables next to your fields. You can think of these variables as being in several groups.
The first and most important group of variables allow 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 alias inside each field. For example, you can load the data from this field by 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}
{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 if you're 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 user's Username.