Restricting access to images for nonmembers?

Hi FJN, welcome to the Kirby Forum!

You can use if ($user = $kirby->user()) to test if there is a user currently logged in to Kirby in a template. So you can wrap this around a section to only show this section to logged in users.

However, there’s some caveats:

  1. Don’t use caching on these pages!
  2. Files remain directly accessible via path

As for 2: you can work around that too, but it’s a bit of work and not always wanted as it affects performance: files are served directly from your webserver without Kirby intercepting (for performance reasons). However, you can shove Kirby in between to manage all requests. There’s a thorough post on how to create an “asset firewall” for Kirby 2. Whilst the philosphy remains the same, I think you’ll have to adapt the code to get it working with Kirby 3 a bit.