Skip to content

Kirby 3.8.4

$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: author@company.com

Template

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