Page Increment not working anymore?

Hi there,

I have a dead simple Hitcounter at each Page:


But since Kirby 3 this isn’t working anymore expect I’m logged in. Seems like there’s something with the Permissions wrong?

Kirby \ Exception \ PermissionException (
You are not allowed to update "xxx"

Your answer can be found here (just for future reference).

To update a page you need the right permissions - and using ->increment() is updating the page, it’s just a shorthand.

One way to go without authentication is to impersonate the special kirby super user, which has full permissions:


$kirby = kirby();


1 Like

Thanks a lot. I have a Query like this:

if ( $site->user() ) {
  echo 'YES USER';

Now this returns always the true value if I impersonate Kirby user, no matter if I’m really a logged in user. Any other solution maybe?

And you $page->increment('hitcounter'); call is happening inside of this if-statement?

Not really but I use the above state to control some CSS and appearance options. Now they are always visible …

Should be $kirby->user() not $site->user(), that has changed from K2 => K3.

1 Like

Thanks, this seems to work :slight_smile:

Thanks for spotting this, @texnixe. Was already on the path down to un-impresonate.