You also have the ability to nest multiple {users} tags. This can be useful to output another set of users for every user shown.

You can also use this technique to use nested If Structures.

Nested Users Tag

To create nested sets, append the {user} or{users} tag of the nested set with an extra name or id, for example -others.

The example below will show all users from the 'Account Managers' usergroup. And under each users name we will list their leads (users for which they are marked as the account manager). We assume there is a custom field called 'accountmanager' which will contain the id of the staff member (select list using the id as the value).

Check out the syntax and the respective result:

{users usergroup="Account Managers" separator="<hr>"}
<h4>[name]</h4>
I am the account manager of: {users-leads usergroup="Leads" accountmanager="[id]" separator=", " last-separator=" and "}[name]{/users-leads}
{/users}

Jessica Hart

I am the account manager of: Liam Ford, Zoe Chase, and Mia Sterling


Oliver King

I am the account manager of: Ethan Wright, Nora Fields, Leo Grant, and Ivy Brook


Grace Lynn

I am the account manager of: Aaron Stone, Eva Green, and Max Hunter

Don't forget to close each users set with a closing tag using the same extra id (in this example: {/users-others}). If you don't close every set, you will get unwanted results.

Nested If Structures

The nested Users tag also allows you to use nested If Structures, which wouldn't otherwise be possible.

You can simply wrap your nested set of {if} tags in a nested {user} or {users} tag. For example:

{users usergroup="Customer" separator="<hr>"}
   <h4>[name]</h4>
{if nr-of-legs = 3}
I have 3 legs.
{user-nested id="[id]"}
{if 'furry' IN my-specs}
I am also also furry.
{elseif 'fluffy' IN my-specs}
I am also very fluffy.
{/if}

  {/user-nested}
{/if}
{/users}