Users Anywhere also supports Pagination, offering the ability to split the returned users in separate pages (similarly to what can be done with the Joomla! Category blog pages).
Pagination by Default
In the Users Anywhere system plugin settings you can decide if you want to enable pagination by default. And you can define the default number of users per page to be returned.
If you enabled pagination by default in the settings, but you don't want it in a specific instance of the {users}
tag, you can individually disable it with:
{users usergroup="Customer" pagination="false"}...{/users}
Pagination in individual tag
Alternatively, if you do not have pagination enabled by default in the settings, you can enable it in a specific instance of the {users}
tag.
You can either make pagination use of the default number of users per page from the settings, simply with:
{users usergroup="Customer" pagination="true"}...{/users}
Or, for more control, you can individually define the number of users per page in each {users}
tag with a per-page="..."
attribute.
To return all users from the category "Animals" and display 10 users per page:
{users usergroup="Customer" limit="false" per-page="10"}...{/users}
Thet limit="false"
attribute allows to not set a limit to the total amount of paginated users, meaning all resulting users will be displayed - divided in pages of course. This is set because, without it, the Default Limit set in the Plugin Settings would limit the total amount of users returned.
Or you can of course combine this with a specified limit="..."
, to set a global limit of returned users and then define the how many per page:
{users usergroup="Customer" limit="40" per-page="10"}...{/users}
Other Settings
When using pagination, Users Anywhere will add a parameter to the URL to generate pagination links and navigate between pages. By default, this is set to ?page=
(followed by the number of the page). The Page URL Parameter can be customized in the plugin settings.
In the plugin settings you can also set the position of the page navigation bar (between top, bottom, or both), and whether to show the pagination results information (such as "Page 1 of 4").
Multiple uses in one webpage
It's important to note that if on the same webpage you use multiple instances of the {users}
tag with pagination, changing page in a set of users would also change page in the other sets of users. This happens because, by default, the Page URL Parameter is shared among all {users}
tag uses.
To make sure that changing page in a set of users doesn't affect the other instances, you can give each {users}
tag its own unique Page URL Parameter by overriding it in the tag with a page_param="..."
attribute:
{users usergroup="Customer" limit="40" per-page="10" page-param="mypage"}...{/users}
Note: If you're using Joomla cache (via Global Configuration, not via the System Plugin), you will need to register these additional URL Parameters as "safe", in order to make Joomla create a unique cache for each page. Users Anywhere allows you to do this in the "Advanced" tab of the plugin settings (for each extra parameter name, you should also specify what type of value it can be).