$user
The $user
object represents a single Panel or frontend user.
-
new User()
-
$user->apiUrl()
-
$user->audio()
-
$user->avatar()
-
$user->blueprint()
-
$user->blueprints()
-
$user->callMethod()
-
$user->changeEmail()
-
$user->changeLanguage()
-
$user->changeName()
-
$user->changePassword()
-
$user->changeRole()
-
$user->clone()
-
$user->code()
-
$user->content()
-
$user->contentFile()
-
$user->contentFileData()
-
$user->contentFileDirectory()
-
$user->contentFileExtension()
-
$user->contentFileName()
-
$user->contentFiles()
-
User::create()
-
$user->createFile()
-
$user->createId()
-
$user->decrement()
-
$user->delete()
-
$user->documents()
-
$user->dragTextFromCallback()
-
$user->dragTextType()
-
$user->email()
-
$user->errors()
-
$user->exists()
-
User::factory()
-
$user->file()
-
$user->files()
-
$user->hardcopy()
-
$user->hasAudio()
-
$user->hasCode()
-
$user->hasDocuments()
-
$user->hasFiles()
-
$user->hasImages()
-
$user->hasMethod()
-
$user->hasNext()
-
$user->hasPrev()
-
$user->hasVideos()
-
User::hashPassword()
-
$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->mediaRoot()
-
$user->mediaUrl()
-
User::model()
-
$user->modified()
-
$user->name()
-
$user->nameOrEmail()
-
$user->next()
-
$user->nextAll()
-
User::nobody()
-
$user->panelIcon()
-
$user->panelImage()
-
$user->panelOptions()
-
$user->panelPath()
-
$user->panelPickerData()
-
$user->panelUrl()
-
$user->password()
-
$user->permissions()
-
$user->prev()
-
$user->prevAll()
-
$user->query()
-
$user->readContent()
-
$user->role()
-
$user->roles()
-
$user->root()
-
$user->save()
-
$user->setSite()
-
$user->siblings()
-
$user->site()
-
$user->toArray()
-
$user->toString()
-
$user->translation()
-
$user->translations()
-
$user->update()
-
$user->username()
-
$user->validatePassword()
-
$user->videos()
-
$user->writeContent()
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.