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.

Please note this method is and thus not intended to be called directly.

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'); 

Internal usage

// basic internal usage
$users = users();

// internal 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.251