Skip to content

Kirby 3.9.8

$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 ?>