Skip to content

Kirby 4.4.1

$field->toUser()

Converts a user email address to a user object

$field->toUser(): Kirby\Cms\User|null

Return type

Kirby\Cms\User|null

Example

Text file

Title: My great article
----
Author: - user://hqq2mn9k

Template

<?php if ($author = $page->author()->toUser()): ?>
<aside class="author">
  <h2><?= $author->name() ?></h2>
  <?= $author->bio()->kirbytext() ?>
</aside>
<?php endif ?>