!$kirby->user() doesn't seem to work inside snippet

Working through the login authentication cookbook, if I include this inside any snippet it breaks the site

<?php if (!$kirby->user()) go(url('login')) ?>

If I include it in a template it works, is this known or am I doing something wrong?

Let me guess:
This snippet is also used by the login page (and the error page).

Tip:
The call of “go(url('login'))” must not be made for these two pages.

And Kirby is not Baron Munchausen, who can pull himself out of the mud.

1 Like

Ha, thanks for that.