When using the multiple {users}
you can also output at any point, just the data from a specific user, by using one of these prefixes before the desired data:
Syntax | Description |
---|---|
current:... |
Any data from the user that is currently displayed, so the user that contains the plugin tag itself. |
next:... |
Any data from the next user in the list of users returned by the plugin tag. |
previous:... |
Any data from the previous user in the list of users returned by the plugin tag. |
first:... |
Any data from the first user in the list of users returned by the plugin tag. |
last:... |
Any data from the last user in the list of users returned by the plugin tag. |
1:... , 2:... , 3:... , 4:... , etc. |
Any data from a specific user in the list of users returned by the plugin tag. The data name must be prepended with the respective count number of the user. |
After the prefix, you can then output any of Data Types, so including user data, category data, user data, and custom field values.
You can combine any prefix with any of the data types. Here are a few examples:
this:id
will output the the ID of the current user that contains the plugin tag or is currently displayednext:title
will output the Title of the next user in the listprevious:alias
will output the Alias of the previous user in the listfirst:category:title
will output the Category Title of the the first user in the listlast:author:name
will output the Author Name of the the last user in the list2:title
will output the Title of the second user in the list- You can output any other available user data or custom field (for example:
this:speaker
)
The count
prefixes can be particularly useful, for example, if you want to display data from two (or more) users side-by-side in a table:
{users usergroup="Herd" limit="4"}{if is-first}
Name | [1:name} | [2:name} | [3:name} | [4:name} |
Username | [1:username] | [2:username] | [3:username] | [4:username] |
Position | [1:contact:position] | [2:contact:position] | [3:contact:position] | [3:contact:position] |
Image 1 | [1:contact:image] | [2:contact:image] | [3:contact:image] | [4:contact:image] |
{/if}{/users}
Name | Sven | Randy | Shelly | Junior |
Alias | sven | randy | shelly8x | helicopters-are-awesome |
Position | Frontman | Programmer | Creative Genius | CHief Of Private Personal Elevation Regulator |
Image | ![]() |
![]() |
![]() |
![]() |
Or if you would like to use data from the returned users in a descriptive text, such as:
{users usergroup="Customer" ordering="ordering ASC" limit="3"}{if is-first}
The Regular Herd members are [1:name], [2:name] and [3:name]. But the most important member of any team is [4:name].
{/if}{/users}
The Regular Herd members are Sven, Randy and Shelly. But the most important member of any team is Junior.
These prefixes can especially be useful in If Structures, for example to highlight the current active user in the list of users returned by Users Anywhere.
The following example checks whether the ID of one of the returned users is the same as the currently displayed user. If it is, we put it in bold text, but we don't add a link to it. We only add a link to it to the other users, not the one currently being displayed.
<ul>{users usergroup="Herd"}<li> {if id = current:id} <strong>[name] (That's you!)</strong> {else} [name] {/if} </li>{/users}</ul>
- Sven
- Randy
- Shelly
- Junior (That's you!)
The following example allows you to output a listing of users grouped by the contact 'Position', with just one {users}
tag. We order users by position, and then we only output a position header if the position of the current user is different from the previous one.
<ul>{users usergroup="Staff" ordering="contact:position ASC, name ASC"} {if contact:position != previous:usergroup}<h2>[usergroup]</h2>{/if} <li>[title]</li> {/users}</ul>
Administrator
- Avery Quinn
- Carter Blake
Creator
- Flynn Morrow
- Luna Everly
- Orion Sage
- Sidney Maxwell
Writer
- Ellis Grey
- Harper Wilde
- Rowan Ashe