Jump to main content Jump to doc navigation

The PeopleGroup Snippet

This snippet displays a User Group and the Users within it.

Usage

Display the User Group "HR Department", along with its Users:

[[PeopleGroup? &usergroup=`HR Department` &toPlaceholder=`users`]]

<h2>[[+peoplegroups.name]] ([[+peoplegroups.userCount]] Users)</h2>

<ul>
[[+users]]
</ul>

Available Properties

Name Description Default
userTpl The Chunk to use for each User. pplGroupUser
limit The number of user groups to limit per call. Defaults to 10. Set to 0 to show all. 0
start The start index to begin with when limiting. 0
sortBy The field name to sort by.) username
sortByAlias The class to use with the sort field. modUser
sortDir The direction to sort by. ASC
cls Will append this CSS class to each item. ppl-user
altCls Optional. If set, will append this CSS class to every even item.
firstCls Optional. If set, will append this CSS class to the first item.
lastCls Optional. If set, will append this CSS class to the last item.
placeholderPrefix The prefix to use when setting global placeholders, such as total. peoplegroups.
outputSeparator The separator between each user record.
toPlaceholder Optional. If set, will set the output to this placeholder and return empty.
userClass The class name of the Users object. modUser
getProfile If true, will also get the Profile fields for each User. 0
profileAlias The class alias of the Profile object. Profile

PeopleGroup Chunks

The only chunk used in the PeopleGroup snippet is the &userTpl property, which uses the default of pplGroupUser.

Examples

Show all the Users of the User Group "Marketing", but sort by Role Authority instead of username:

[[!PeopleGroup?
  &usergroup=`Marketing`
  &placeholderPrefix=`ug.`
  &toPlaceholder=`ug.users`
  &sortBy=`authority`
  &sortByAlias=`UserGroupRole`
]]

<h2>Users in [[+ug.name]]</h2>

[[+ug.users]]

See Also

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • Fabian Christen
  • Dannevang Digital
  • Sepia River Studios
  • Chris Fickling
  • CrewMark
  • deJaya
  • Lefthandmedia
  • Murray Wood
  • eydolan
  • Following Sea
  • Anton Tarasov
  • Stéphane Jäggi
  • Raffy
  • Snow Creative
  • A. Moreno
  • Nick Clark
  • JT Skaggs
  • Helen
  • YJ
  • krisznet
  • Richard
  • Yanni

Budget

$301 per month—let's make that $500!

Learn more