Edition note: The multiple-user {users} tag and its separation, ordering, limit, offset, minimum, and empty-output controls are Pro features. The fixhtml override described at the end of this page is available for the single-user {user} tag in both Free and Pro.

Separating the Output PRO

The output of the multiple {users} tag will be whatever output is generated for every user depending on your Data Tags.
This includes any markup you place between the {users} tags like new lines.

Let’s say you want to list all titles of all the users in the usergroup "Customer". And you do:

{users usergroup="Customer"}[name]{/users}
Abigail BennettBrandon Carter ...Violet UnderwoodWilliam Young

As you can see all names are output as one long line without any spaces or lines between the different names.

This behavior might be desired when surrounding the Data Tags with a customized div layout, but in this example, we will most likely want to separate the users' names.

To output every name on a new line, you can simply place the closing {/users} tag on a new line:

{users usergroup="Customer"}[name]
{/users}
Abigail Bennett
Brandon Carter
...
Violet Underwood,
William Young

But what if you want a comma-separated list? To do that, you can use the separator="..." attribute. This will place whatever you put inside the separator attribute between every user. For example:

{users usergroup="Customer" separator=", "}[name]{/users}
Abigail Bennett,Brandon Carter, ..., Violet Underwood, William Young

You can also add last-separator="..." to use a different separator between the last 2 users:

{users usergroup="Customer" separator=", " last-separator=" and "}[name]{/users}
Abigail Bennett,Brandon Carter, ..., Violet Underwood and William Young

Ordering PRO

In the Users Anywhere system plugin settings you can define the default ordering of the users returned by the plugin tag.

You can override the ordering in the {users} tag by adding an ordering="..." attribute.

You can order users by supported user/account fields, profile values, published contact values, access levels, user groups, and user custom fields. Use the same data keys documented in the Data Tags overview.

Common ordering keys include:

  • name — the user's display name
  • username — the user's username
  • id — the user ID
  • register-date or lastvisit-date — when the account was registered or last visited
  • profile:city — a Joomla User Profile value
  • contact:position or contact:email — data from the user's published contact
  • usergroup or accesslevel — membership and viewing-access data
  • field:my-field — a user custom field, selected by alias or ID
  • random — a random order

Do not put square brackets around ordering keys. Authentication secrets and arbitrary database columns are not available as ordering data.

Ordering Direction

You can then specify the ordering direction with either ASC for ascending, or DESC for descending.

For example, to output all users that are in the "Customer" user group ordered by name (alphabetically) in ascending order:

{users usergroup="Customer" ordering="name ASC"}...{/users}

To place all users that are in the "Customer" and "Manager" user groups in random order:

{users usergroup="Customer,Manager" ordering="random"}...{/users}

Multiple Orderings

You can even specify subsequent orderings to be used, in order of precedence, when the value of the first ordering is the same. You do so by simply separating the multiple orderings via comma:

{users usergroup="Customer" ordering="lastvisit-date DESC, name ASC"}...{/users}

There is no limit to how many levels of ordering you can use. If the values of all specified orderings are the same for certain users, the output will fall back to the default ordering set in the Plugin Settings.

Limit/Range PRO

By default Users Anywhere will show up to 100 users matching the given Filters. But in the Users Anywhere system plugin settings you can change the default limit of maximum users to be returned.

And you can also individually define the limit for each {users} tag with a limit="..." attribute.

For example, to place only the first 20 users from the category "Animals":

{users usergroup="Customer" limit="20"}...{/users}

Offset

You can also show a range of users not starting from the start. For instance, to show users 11 to 30, you can do:

{users usergroup="Customer" limit="11-30"}...{/users}

Alternatively, you can use an offset="..." attribute to simply exclude the first X amount of users from the results.

The following example achieves the same result as before, showing users 11 to 30 (20 users starting from the 11th):

{users usergroup="Customer" offset="10" limit="20"}...{/users}

Minimum

You can also define a minimum number of users that should be returned, by using a minimum="..." attribute:

{users usergroup="Customer" minimum="3" limit="20" empty="Less than 3 users found!"}...{/users}

If the tag (with the specified filters) does not result in at least the set minimum amount of users, the output will return empty.

Output when empty PRO

Let's say you created a tag to output all users from the user group "Customer" that have "Gold" as the value for the custom field "subscription". But when there are no users matching these filters, you want to place a little message saying "Currently no Gold Subscribers! Business is slow 😕".

You can place this text in the empty attribute:

{users usergroup="Customer" subscription="Gold" empty="Currently no Gold Subscribers! Business is slow 😕"}...{/users}

You can use some markup inside the empty attribute. And add links and such. But if you want to output more complex content when there are no results, you can also use the {users-else} tag:

{users usergroup="Customer" subscription="Gold"}
...
{users-else}
<div class="alert alert-info">Currently no Gold Subscribers! Business is slow 😕</div>
{/users}

Which would result in:

Currently no Gold Subscribers! Business is slow 😕

Fix HTML

fixhtml is available in both Free and Pro. By default, Users Anywhere tries to fix HTML structure issues around the rendered tag output.

In the Users Anywhere system plugin settings you can control the setting. This is on by default as it’s often necessary to deal with surrounding HTML tags. Only switch this off if you have issues with this.

You can individually override this setting in the {users} tag by adding a fixhtml="..." attribute with either a true (on) or false (off) value.

{users usergroup="Customer" fixhtml="false"}...{/users}