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
Name | Return | Summary | |
---|---|---|---|
$users->add() $users->add($name) $users->add($name) | User | Add new User with the given name and return it. | |
$users->delete() $users->delete($user) $users->delete($user) | bool | Delete the given User. | |
$users->find() $users->find($selector) $users->find($selector) | PageArray | Return the User(s) matching the the given selector query. | |
$users->get() $users->get(string $selectorString) $users->get(string $selectorString) | User NullPage null | Get the user by name, ID or selector string | |
$users->getCurrentUser() $users->getCurrentUser() $users->getCurrentUser() | User | Returns the current user object | |
$users->getGuestUser() $users->getGuestUser() $users->getGuestUser() | User | Get the 'guest' user account | |
$users->save() $users->save(Page $page) $users->save(Page $page) | bool | Save a User | |
$users->setAdminThemeByRole() $users->setAdminThemeByRole($adminTheme, Role $role) $users->setAdminThemeByRole($adminTheme, Role $role) | int | Set admin theme for all users having role | |
$users->setCurrentUser() $users->setCurrentUser(User $user) $users->setCurrentUser(User $user) | (nothing) | Set the current system user (the $user API variable) |
For hooks
These methods are only useful for hooking and should not be called directly.
Name | Return | Summary | |
---|---|---|---|
$users->added() $users->added($user) $users->added($user) | (nothing) | Hook called just after a User is added | |
$users->deleteReady() $users->deleteReady($user) $users->deleteReady($user) | (nothing) | Hook called before a User is deleted | |
$users->deleted() $users->deleted($user) $users->deleted($user) | (nothing) | Hook called after a User is deleted | |
$users->saveReady() $users->saveReady(Page $page) $users->saveReady(Page $page) | array | Hook called just before a user is saved | |
$users->saved() $users->saved($user, array $changes) $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:
API reference based on ProcessWire core version 3.0.236