Manages all users (User objects) in ProcessWire.

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon. In addition to those shown below, the Users class also inherits all the methods and properties of: PagesType and Wire.

Common / For hooks


Name Return Summary  
$users->add($name) User Add new User with the given name and return it.
$users->delete($user) bool Delete the given User.
$users->find($selector) PageArray Return the User(s) matching the the given selector query.
$users->get(string $selectorString) Page, NullPage or null Get the user by name, ID or selector string
$users->getCurrentUser() User Returns the current user object
$users->getGuestUser() User Get the 'guest' user account
$users->save($user) bool Save given User.
$users->setCurrentUser(User $user) (nothing) Set the current system user (the $user API variable)

For hooks

This methods are only useful for hooking and should not be called directly.

Name Return Summary  
$users->added($user) (nothing) Hook called just after a User is added
$users->deleteReady($user) (nothing) Hook called before a User is deleted
$users->deleted($user) (nothing) Hook called after a User is deleted
$users->saveReady($user) array Hook called just before a User is saved
$users->saved($user, array $changes) (nothing) Hook called after a User has been saved

Additional methods and properties

In addition to the methods and properties above, Users also inherits the methods and properties of these classes: