The UserList allows you to show a list of users from your project.

Example 1

<fm:UserList fields="id,user"> <fm:Loop> <a href="/profile/{$$}">{$$user.user}</a><br /> </fm:Loop> </fm:UserList>

Supported attributes

accounttypeOptionalFilters based on the account type
activeOptionalnoneFilters the results based on whether the users are active or not.
Supported values are either 'true' (users with active accounts) or 'false' (users with non-active accounts). Leave out to get users with active and non-active accounts
assignmentNotificationOptionalnoneFilters based on the notifications enabled, either 0 or 1
cityOptionalFilters based on the city
countryOptionalFilters based on the country
deviceGeoCenterOptionalnoneLatitude,Longitude center point to be used with deviceGeoDistance
deviceGeoDistanceOptionalnoneDistance in meters user can be from the deviceGeoCenter location
disabledOptionalnoneFilters the results based on whether the users have their accounts disabled or not.
Supported values are either 'true' (users with disabled accounts) or 'false' (users with non-disabled accounts). Leave out to get users with disabled and non-disabled accounts
emailOptionalFilters based on the email address
evenClassOptionalThe contents of this attribute will be placed in the 'loop.evenClass' template variable, only for even row-numbers. This allows you to give every even row a specific css class
fieldsOptionalSee belowComma-separated list of fields you'd like to use. See below for a list of supported fields
firstnameOptionalFilters based on the first name
genderOptionalFilters based on the gender
groupIdOptionalnoneOnly return users in the specified group
lastnameOptionalFilters based on the last name
occupationOptionalFilters based on the occupation
oddClassOptionalThe contents of this attribute will be placed in the 'loop.oddClass' template variable, only for odd row-numbers. This allows you to give every odd row a specific css class
pageSizeOptional100The number of items per page
schoolOptionalFilters based on the school
sortOptionalcreated DESCSortfield. You can currently sort on id, user, firstname, lastname, friends, publicfiles, nickname, city, country, gender, email, unmoderatedfiles, approvedfiles, deniedfiles, active, lastlogin and created. By default this component will sort Descending, to sort Ascending use for example 'friends ASC'
startPageOptional0The starting page. This is a 0-based index
stateOptionalFilters based on the state
userOptionalFilters based on the username

Note: All filters are "or"ed together so the following user list would include users who have either (or both) "martin" as their first or last names.

<fm:UserList firstname="martin" lastname="martin">[...]</fm:UserList>

The 'fields' attribute supports the following:

  • accounttype
  • active
  • address1
  • address2
  • approvedcomments
  • approvedfiles
  • avatar
  • birthdate
  • cellphone
  • city
  • country
  • created
  • deniedcomments
  • deniedfiles
  • description
  • disable_media_notifications
  • disable_thread_notifications
  • disabled
  • email
  • firstname
  • followers
  • following
  • friends
  • gender
  • geo_latitude
  • geo_longitude
  • id
  • language
  • lastlogin
  • lastname
  • meta
  • newsletter
  • nickname
  • occupation
  • phone
  • pointtotal
  • postalcode
  • profile_complete
  • publicfiles
  • state
  • unmoderatedcomments
  • unmoderatedfiles
  • user
  • vhost
  • website

Template variables

loop.hasResultsThe contents of this variable will be either 0 or 1, depending on if there are items in the list.
loop.oddClassThe contents of this variable will reflect the "oddClass" attribute. This will only be set for odd rownumbers.
loop.evenClassThe contents of this variable will reflect the "evenClass" attribute. This will only be set for even rownumbers.
loop.indexThe 0-based index of the item in the loop. (Will contain 0,1,2,3,4, etc.)
loop.countThe count of the current item in the loop. (Will contain 1,2,3,4,5 etc.)
loop.currentPageIf a pager is involved in this loop, this will contain the current page number (0-based index). If page information is not available, this will be 0.
loop.currentPage1This value is currentPage + 1. This number can be useful to display the current page number to use user. (people generally count from 1, not 0).
loop.totalPagesTotal number of pages avaiable in this loop. This will be 0 if the loop does not support paging.
loop.totalItemsTotal number of individual items. This will be 0 if the loop does not support paging.
loop.pageSizeTotal number of items on 1 single page. This will be 0 if the loop does not support paging.
user.userThe username
user.emailUser's email address
user.firstnameUser's given name
user.lastnameUser's family name
user.address1Address line 1
user.address2Address line 2
user.cellphoneUser's cellphone number
user.phoneUser's homephone number
user.cityUser's city
user.countryUser's 2-letter country code
user.createdCreated date and time
user.friendsNumber of friends
user.geo_latitudeThe user's latitude
user.geo_longitudeThe user's longitude
user.idThe user's unique id
user.metaThe user's meta-data (an array). Its values are configurable in the user profile page. Because the user's metadata is configurable, its variables differ for each user.
Sample user_metadata variables for the templates are:
  • {$$user.meta.lang} - the user's metadata language
  • {$$user.meta.twitterUserName} - the user's metadata twitter username
  • {$$user.meta.rules} - the user's rules
user.json_metaThe User's meta-data represented as a json object.
user.descriptionThe user's description
user.genderThe user's gender
user.websiteThe user's website
user.occupationThe user's occupation
user.nicknameThe user's displayname/nickname
user.accounttypeThe user's account type. Numeric field (integer) Its value can range from 0 to 262144 (2^18). Its value is held in the variable {$$loggedinuser.accounttype}. Most likely values are 10, which stands for voter, and 11 which denotes entrant. The value can be set by template developers, who can set the value of the intergs to have any meaning that is necessary.
Examples of filetypes:
1 = Administrator
2 = User
10 = Voter
11 = Entrant
user.postalcodeThe user's postalcode
user.approvedfilesThe number of approved media items this user has
user.deniedfilesThe number of denied media items this user has
user.unmoderatedfilesThe number of unmoderated media items this user has
user.publicfilesThe number of uploads this user did
user.state2-letter state code
user.externalidsArray of external ids from various providers the user may have. Eg. user.externalids.0.external_id_provider, user.externalids.0.external_id, user.externalids.0.external_id_sub_provider
user.deviceinfoAn array of the user's devices, returned only when fields[deviceinfo] is set. The values returned are as follows: (with i being the iterator of the user's devices, should the user have more than one)

  • {$$} - (Integer) The id of the device. ie: 54321
  • {$$user.deviceinfo.i.uid} - (Integer) The id of the user.
  • {$$user.deviceinfo.i.vhost} - (Integer) The id of the vhost.
  • {$$user.deviceinfo.i.device_id} - (String) The string id of the device.
  • {$$user.deviceinfo.i.latitude} - (FLoat) The latitude of the device. Ie: 43.635609
  • {$$user.deviceinfo.i.longitude} - (FLoat) The longitude of the device. Ie: -79.424858
  • {$$user.deviceinfo.i.lastupdatetime} - (Datetime) The datestamp of the last occurance that the device was used to connect to the application. Ie: 2012-12-07 11:40:56
  • {$$user.deviceinfo.i.commentnotification} - (Integer) Indicates whether the user enabled their comment notifications or not. Values: 1 (yes) or 0 (no)
  • {$$user.deviceinfo.i.assignmentnotification} - (Integer) Indicates whether the user enabled their assignment notifications or not. Values: 1 (yes) or 0 (no)
  • {$$user.deviceinfo.i.settings} - a serialized string with the user's settings: ie: a:1:{s:22:"notificationBadgeCount";s:1:"0";}
user.offset0-based offset from start of list. Example: the fourth user on the second page, where pages are 50 users long, has offset 53.
user.filterstringProvides a string to be used in conjunction with the fm:UserNext and fm:UserPrevious components. This string will contain all filters and sorting that was applied to this user list. Use this in a link as "<a href='/profile/{$$}?{$$user.filterString}'>{$$user.user}</a>".
user.disable_media_notificationsThe user's setting for Media notifications - an integer: (0 for allow notifications, 1 for disable notifications)
user.disable_thread_notificationsThe user's setting for Thread notifications - an integer: (0 for allow notifications, 1 for disable notifications)

See also

More examples

Example 2

This list sorts the Users by the number of friends they have, and displays a gravatar for each user.

<fm:UserList fields="id,email" sort="friends DESC"> <fm:Loop> <a href="/profile/{$$}"><fm:Gravatar email="{$}" default="monsterid" /></a><br /> </fm:Loop> <fm:NoResults> Poor you, no users were found </fm:NoResults> </fm:UserList>

Example 3

The following example lists the Users for a vhost and displays their firstname, lastname, username, metadata language, metadata Twitter username and metadata rules.

<fm:UserList fields="id,user,firstname,lastname,meta" sort="nickname DESC" active="true"> <table> <tr> <th>User id </th> <th>Firstname Lastname </th> <th>user.user </th> <th>user.meta.lang </th> <th>user.meta.twitterUserName </th> <th>user.meta.rules </th> </tr> <fm:Loop> <tr> <td>{$$} </td> <td><a href="/profile/{$$}">{$$user.firstname} {$user.lastname}</a></td> <td>{$$user.user} </td> <td>{$$user.meta.lang}</td> <td>{$$user.meta.twitterUserName}</td> <td>{$$user.meta.rules}</td> </tr> </fm:Loop> </table> </fm:UserList>

Example 4

The following example lists all the users for the application, and their deviceInfo; by setting deviceGeoCenter="0,0" and deviceGeoDistance="0", you get the list of all the users and their device info.
If you set the deviceGeoCenter to "45.00,-70.00" and deviceGeoDistance="10000" you will get a list of all the users whose devices are located within 10 km (10,000 meters) of the Geo Center, which is set as 45.00 degrees north and 70.00 east.
The following example shows the user's id,, deviceInfo.0.latitude and deviceInfo.0.longitude.

<fm:UserList deviceGeoCenter="0,0" deviceGeoDistance="0" > <fm:Loop> {$}, {$$}, user.deviceInfo.0.latitude: {$$user.deviceInfo.0.latitude}, user.deviceInfo.0.longitude: {$$user.deviceInfo.0.longitude} </BR> </fm:Loop> </fm:UserList>