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 "}[title]{/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 the output of the users by a huge range of data types, including any user data, contact data, dates, and even by custom field values - pretty much by anything you can think of.

Here are just some of the most common orderings available:

  • name the name of the user
  • username the username of the user
  • id the ID of the user
  • hits the number of views that the user received
  • register-date, lastvisit-date the dates the user registered or last visited the site.
  • contact:name the name of the contact attached to the user.
  • [contact:con_position the position of the contact attached to the user. [contact:email_to the email address of the contact attached to the user. [contact:... any other field available in the contact attached to the user.
  • my-custom-field the value of any Custom Field attached to the user. Use the name/alias of the desired field, for example: nr-of-legs
  • random random order

Check out the Full List of Data Types available for everything you can use as ordering.

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 PRO

By default, Users Anywhere will try to fix any HTML structure issues it finds.

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}