$user
The $user
object represents a single Panel or frontend user.
-
$user->audio()
-
$user->avatar()
-
$user->blueprint()
-
$user->blueprints()
-
$user->changeEmail()
-
$user->changeLanguage()
-
$user->changeName()
-
$user->changePassword()
-
$user->changeRole()
-
$user->clone()
-
$user->code()
-
$user->content()
-
$user->contentFiles()
-
$user->createFile()
-
$user->createId()
-
$user->decrement()
-
$user->delete()
-
$user->documents()
-
$user->email()
-
$user->errors()
-
$user->exists()
-
$user->file()
-
$user->files()
-
$user->hardcopy()
-
$user->hasAudio()
-
$user->hasCode()
-
$user->hasDocuments()
-
$user->hasFiles()
-
$user->hasImages()
-
$user->hasNext()
-
$user->hasPrev()
-
$user->hasVideos()
-
$user->id()
-
$user->image()
-
$user->images()
-
$user->increment()
-
$user->indexOf()
-
$user->inventory()
-
$user->is()
-
$user->isAdmin()
-
$user->isFirst()
-
$user->isKirby()
-
$user->isLast()
-
$user->isLastAdmin()
-
$user->isLastUser()
-
$user->isLocked()
-
$user->isLoggedIn()
-
$user->isNobody()
-
$user->isNth()
-
$user->isValid()
-
$user->kirby()
-
$user->language()
-
$user->lock()
-
$user->login()
-
$user->loginPasswordless()
-
$user->logout()
-
$user->modified()
-
$user->name()
-
$user->nameOrEmail()
-
$user->next()
-
$user->nextAll()
-
$user->panel()
-
$user->password()
-
$user->passwordTimestamp()
-
$user->permissions()
-
$user->prev()
-
$user->prevAll()
-
$user->role()
-
$user->roles()
-
$user->root()
-
$user->siblings()
-
$user->site()
-
$user->toArray()
-
$user->toSafeString()
-
$user->toString()
-
$user->translation()
-
$user->translations()
-
$user->update()
-
$user->username()
-
$user->uuid()
-
$user->validatePassword()
-
$user->videos()
-
new User()
-
User::create()
How to create a $user
object
Before you can call the methods of the User class, you need a $user
object.
The $user
object is available via the $kirby
object:
The current user
A specific user by user id or email address
The first user of the users collection
Before calling any of the methods of the User class, verify that you have a valid User object.
Examples
With the $user
object in place, you can use the methods of the user class to get information about the user or modify the user object.
Check if the user is an admin
Convert user object to array
Change the user name programmatically
Fetch all files belonging to the user object
To keep the examples short, we don't check if the (user) object exists in the examples above. In your code, you should always do that.