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

**URL:** <https://forum.getkirby.com/t/kirby-user-doesnt-seem-to-work-inside-snippet/17500>\
**Category:** Questions\
**Tags:** v3\
**Created:** [March 3, 2020, 3:54pm UTC](https://forum.getkirby.com/t/kirby-user-doesnt-seem-to-work-inside-snippet/17500 "2020-03-03T15:54:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kinkwilde](https://avatars.discourse-cdn.com/v4/letter/k/94ad74/32.png) [@kinkwilde](https://forum.getkirby.com/u/kinkwilde)\
**Post date:** [March 3, 2020, 3:54pm UTC](https://forum.getkirby.com/t/kirby-user-doesnt-seem-to-work-inside-snippet/17500/1 "2020-03-03T15:54:45Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![anon77445132](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@anon77445132](https://forum.getkirby.com/u/anon77445132)\
**Post date:** [March 3, 2020, 4:53pm UTC](https://forum.getkirby.com/t/kirby-user-doesnt-seem-to-work-inside-snippet/17500/2 "2020-03-03T16:53:08Z")

</div>

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](https://en.wikipedia.org/wiki/Baron_Munchausen), who can pull himself out of the mud.

---

<div class="post-metadata">

**Author:** ![kinkwilde](https://avatars.discourse-cdn.com/v4/letter/k/94ad74/32.png) [@kinkwilde](https://forum.getkirby.com/u/kinkwilde)\
**Post date:** [March 3, 2020, 5:07pm UTC](https://forum.getkirby.com/t/kirby-user-doesnt-seem-to-work-inside-snippet/17500/3 "2020-03-03T17:07:34Z")

</div>

Ha, thanks for that.
