Template tags
Seven tags. None of them require JavaScript.
{exp:wrangler:submit_form}
Wraps its own tag pair in a form that opens a ticket. You write the inputs; the tag supplies the
<form> element, the CSRF token, a honeypot, and a signed render timestamp.
| Parameter | Purpose |
|---|---|
return= |
Template path to land on after a successful submit. Must be site-relative. |
class= / id= |
Attributes for the <form> element. |
| Variable | Value |
|---|---|
{error_message} |
Why the last attempt failed. Empty otherwise. |
{if error} |
True when the last attempt failed. |
{subject} / {message} |
Sticky values from a failed attempt. |
{name} / {email} |
Sticky guest contact details from a failed attempt. Empty for members. |
{selected_queue} |
The queue chosen on a failed attempt. |
{if has_queues} |
True when at least one queue is configured. |
{queues} |
Variable pair over the configured queues. Each row has {queue} and {if is_selected}. |
{if logged_in} / {if logged_out} |
Whether a member is signed in. |
{if needs_contact_info} |
True when name and email inputs should be shown. |
{if allow_guest_tickets} |
The current setting. |
{custom_fields} / {if has_custom_fields} |
The fields from Settings → Custom fields. See Custom fields. |
Recognised inputs: subject and message (required); name and email (required for guests);
priority and queue (optional, validated against your settings); and any input named
meta:something, which is stored on the ticket and shown to staff in the meta header.
Building the queue dropdown
The posted queue has to match a configured queue exactly — same spelling, case and spacing.
A value that does not match is dropped silently: the ticket is still created, just with no
queue and no error. Hardcoding the options therefore means a queue renamed in settings quietly
stops categorising new tickets.
Use the {queues} pair instead and both sides come from one source:
{if has_queues}
<label for="wr-queue">What is this about?</label>
<select id="wr-queue" name="queue">
<option value="">Choose one…</option>
{queues}
<option value="{queue}"{if is_selected} selected{/if}>{queue}</option>
{/queues}
</select>
{/if}
Rename a queue in settings and the dropdown follows on the next page load, with no template
edit. {if is_selected} keeps the visitor's choice through a rejected submission.
This is how to model products you support: name the queues after your products, and every
ticket arrives already filed against one. Queue is a sortable column and a filter in the
control panel, so staff can work a single product at a time. If you also need a version, keep
the product in the queue and add a meta:version input alongside it.
If guest tickets are switched off and nobody is signed in, the tag renders {if no_results}.
{exp:wrangler:ticket}
One ticket, for whoever is authorized to see it.
| Parameter | Purpose |
|---|---|
reference= |
Which ticket to load. Used for signed-in members; ignored for token holders, because a token already names exactly one ticket. |
token= |
The raw magic-link token, normally the URL segment after the reference. |
Top-level variables: {reference} {subject} {status} {status_label} {priority}
{priority_label} {queue} {requester_name} {requester_email} {created_at}
{last_message_at} {message_count}, the conditionals {if is_open} and {if is_closed}, and
one {meta:key} (also {field:key}) per value stored on the ticket. The {custom_fields} pair
lists the answered custom fields with {field_label} and {field_value}; {if has_custom_fields}
says whether there are any.
Date variables accept EE formatting, e.g. {created_at format="%Y-%m-%d %H:%i"}.
The {messages} pair yields {author_name} {author_type} {message} {message_date} and the
conditionals {if is_staff} and {if is_customer}.
Use {message_date} for when a message was posted, e.g.
{message_date format="%F %j, %Y, %g:%i %a"}. Inside the pair, {created_at} is still the
ticket's opening date — ExpressionEngine fills the outer tag's variables everywhere, loops
included — which is why the message date has its own name.
Internal notes are excluded by the database query, not filtered out of the loop, so a staff note cannot reach the page even if a template does something unexpected with the data.
The tag renders {if no_results} when the requester is not authorized, when the reference is
unknown, and when the token is wrong. All three look identical on purpose, so the tag cannot be
used to work out which references exist.
{exp:wrangler:tickets}
A signed-in member's own tickets.
| Parameter | Default | Purpose |
|---|---|---|
status= |
— | Restrict to new, open, pending or closed. |
limit= |
20 |
Maximum rows. |
orderby= |
last_message_at |
One of created_at, updated_at, last_message_at, status, priority, subject, reference. |
sort= |
desc |
asc or desc. |
Variables per row: {reference} {subject} {status} {status_label} {priority}
{priority_label} {queue} {created_at} {last_message_at} {if is_open} {if is_closed}.
This tag has no token path. A magic link grants one ticket, never an index, so a logged-out
visitor holding a perfectly valid token still gets {if no_results} here.
{exp:wrangler:reply_form}
Wraps its tag pair in a form that adds a customer reply. Takes the same reference= and
token= parameters as {exp:wrangler:ticket}, plus return=, class= and id=. The only
input it reads is message.
Renders {if no_results} for anyone not authorized to reply. Variables: {reference}
{error_message} {if error} {message} (sticky) and {if is_closed}.
{exp:wrangler:recover_form}
"Lost your link?" Wraps its tag pair in a form with one input, email. On submit, Wrangler
emails that address one message listing every ticket opened with it, each with its private
link. Takes return=, class= and id=.
| Variable | Value |
|---|---|
{if success} / {success_message} |
After a submit. |
{if error} / {error_message} |
A malformed address. |
{email} |
Sticky value. |
The page says the same thing whether or not the address has tickets, so the form cannot be used to find out who has contacted you. The email only ever goes to the address the tickets are already on, and each address can ask three times a day.
When a ticket page says "we could not find that ticket"
{exp:wrangler:ticket} and {exp:wrangler:reply_form} show the same message for every
failure, on purpose — an unauthorised visitor must not be able to learn which references
exist. That is right for them and unhelpful for you, so there is a switch that explains the
refusal in Developer Log. In system/user/config/config.php:
$config['wrangler_debug'] = true;
Then reload the failing page and read the log. You will get one line per refusal naming the requester, the reference, the state of the token, and the URL that was requested:
Wrangler {exp:wrangler:ticket} refused. Requester: anon. Reference: WR-0042.
Token: none found in token= or in the URL. URL: /support/ticket/WR-0042
The token is logged as a short fingerprint, never in full. Turn it off when you are done — a crawled ticket page will otherwise fill the log.
The tag finds the reference and token on its own
The sample templates pass reference="{segment_3}" token="{segment_4}", which is right only
when the ticket page sits exactly two segments deep. Put the templates in your site's default
group, or nest them one level further in, and those segment numbers point at the wrong things.
Both tags therefore fall back to reading the reference and the token out of the URL whenever
the parameters do not produce something of the right shape. A WR- reference and a 64-character
token are both recognisable on sight, so the tags work wherever the page lives, and the
parameters remain the fastest path when they are correct. Nothing is loosened by this: a token
still has to match a stored one, so this changes only where the tag looks.
{exp:wrangler:branding}
The Branding settings, for a template that wants them. Takes no parameters.
| Variable | Value |
|---|---|
{branding_css} |
A complete <style> block overriding the stylesheet's colour tokens. Empty when nothing is configured. |
{logo_url} / {if has_logo} |
The configured logo, if any. |
{brand_background} / {brand_accent} |
The raw hex values, empty when unset. |
{if is_branded} |
True when any of the three settings is set. |
The usual use is one line in <head>:
{exp:wrangler:branding}{branding_css}{/exp:wrangler:branding}
This works because every colour in the sample stylesheet routes through a custom property on
:root — the tag overrides those properties rather than adding rules. Rewrite the stylesheet
however you like and CP theming keeps working, as long as --wr-paper, --wr-blue and
--wr-blue-lift survive. Hover states are derived from the accent, so you set one colour rather
than two.
An unconfigured site emits nothing at all — not an empty <style> block — so it is safe to
include unconditionally.
Do not nest this inside another Wrangler tag. EE does not parse one module tag inside another; call it separately, as the sample templates do.
A note on caching
Do not enable template caching on a page carrying either form. The CSRF token and action IDs are substituted after the cache layer so they stay correct, but the error and sticky-value variables come from flashdata and a cached page will not show them.