Get, find or save users ($users API variable as a function)

This function behaves the same as the $users API variable, though does support an optional shortcut argument for getting a single user or finding multiple users.

Example

// Get a single user (regular and shortcut syntax)
$u = users()->get('karen');
$u = users('karen');

// Find multiple users (regular and shortcut syntax)
$us = users()->find('roles.name=editor');
$us = users('roles.name=editor'); 

Usage

// basic usage
$users = users();

// usage with all arguments
$users = users($selector = '');

Arguments

NameType(s)Description
selector (optional)string, array, int

Optional selector to send to find() or get()

  • Specify user name or ID to get and return that User
  • Specify a selector string to find all users matching selector (PageArray)

Return value

Users PageArray User mixed


Functions methods and properties

API reference based on ProcessWire core version 3.0.236

Latest news

  • ProcessWire Weekly #522
    In the 522nd issue of ProcessWire Weekly we'll check out the latest core updates, introduce a new module called File Mover, and more. Read on!
    Weekly.pw / 11 May 2024
  • ProFields Table Field with Actions support
    This week we have some updates for the ProFields table field (FieldtypeTable). These updates are primarily focused on adding new tools for the editor to facilitate input and management of content in a table field.
    Blog / 12 April 2024
  • Subscribe to weekly ProcessWire news

“Yesterday I sent the client a short documentation for their ProcessWire-powered website. Today all features already used with no questions. #cmsdoneright—Marc Hinse, Web designer/developer