Username shows some letters but not the username

Hi there. I’m relatively new at Kirby and I’m struggling to get the user name:

In my blueprint I have a user field:

type: users

Everything works well, I can choose from the Kirby users.

If I try to show the user at the page

<?= $page->author() ?>

I get something like RzB9a3hd (Instead of Peter Muster).

In the txt file of the page it also shows this letters:


  • RzB9a3hd

Do I miss something?

1 Like

Welcome to the forum! :wave:

Kirby stores the user ID (folder name in site/accounts) by default. You can use the following method to dynamically get the user data:

Thanks for the fast answer.

I tried that: <?= $page->author()->toUser() ?>

Same result: RzB9a3hd (instead of showing the user name).

Found it: $page->author()->toUser()->name()

Sorry. Thanks for helping!

Please see the example on the page I linked and use an if. This ensures that you won‘t run into errors if the user was not found.

This should go into an if statement though:

if ($user = $page->author()-toUser()) {
  echo $user->name();