Reference

Guide

$user->username()

Returns the username which is the given name or the email as a fallback

$user->username(): string|null

Return type

string|null

Example

<?= $kirby->user('bastian@example.com')->username() ?>

Source code

kirby/src/Cms/User.php#L772