Skip to content
  1. Extras
  2. pdoTools
  3. Snippets
  4. pdoUsers

pdoUsers

Snippet to list the site users, based on the pdoTools library.

It generates a list of site users according to their's groups and roles.

Settings

It uses all General Settings of pdoTools except the specific class modResource, as well as their own:

NameDefaultDescription
&groupsList of user groups, separated by commas. You can use the names and id. If the value begins with dash it means users belonging to this group will be skipped.
&rolesList of user roles, separated by commas. You can use the names and id. If the value begins with a dash, then users with this role will be skipped.
&usersList for output, separated by commas. You can use usernames and id. If the value begins with a dash, that user will be excluded from the results.
&showInactive0Includes Inactive users in the results.
&showBlocked0Includes Blocked users in the results.
&returnIdsReturns a string with a list of user ids instead of formatted results.
&showLog0Show more information about running the snippet. Only displayed for logged-in users with the «mgr» context authorization.
&toPlaceholderIf not empty, this will the save output to a placeholder with this name instead of displaying the output to the screen.
&wrapIfEmptyIncludes output chunk wrapper &tplWrapper even if there are no results.
&tplWrapperChunk - wrapper, to wrap all results. Accepts one placeholder:[[+output]]. It does not work in conjunction with &toSeparatePlaceholders.

Override pdoTools

NameDefaultDescription
&classmodUserThe base User class for MODX Revolution
&sortbymodUser.idAny user field for sorting. You can specify a JSON string with an array of multiple fields. To randomly select the sort «RAND ()»
&sortdirASCSorting direction: Descending «DESC» or Ascending «ASC» .

All default templates are empty. To display the result as HTML, you must specify at least the value of the template in &tpl.

Examples

Used without parameters, the snippet lists all users:

modx
[[!pdoUsers]]

Members of usergroup Authors:

modx
[[!pdoUsers?
  &groups=`Authors`
  &tpl=`tpl.Authors.author`
  &sortdir=`asc`
]]

You can combine it with pdoPage / getPage:

modx
[[!pdoPage?
  &element=`pdoUsers`
  &groups=`Authors`
  &tpl=`tpl.Authors.author`
  &sortdir=`asc`
]]

with INLINE:

modx
[[!pdoUsers?
  &roles=`Member`
  &tpl=`@INLINE <p>Имя - [[+fullname]], ID - [[+id]]</p>`
  &sortby=`id`
  &sortdir=`asc`
]]

Demo

Authors and friends of the Simple Dream repository.

Demo