diff --git a/index.php b/index.php index 23779af..2b63ada 100644 --- a/index.php +++ b/index.php @@ -91,6 +91,22 @@ Kirby::plugin( $pages = site()->index(true)->filterBy("linkLocation", $linkLocation); foreach ($pages as $page) { + if (kirby()->plugin("hobbyhome/permissions")) { + // Hacky way of allowing us to run a hook multiple times from within another hook. + $events = kirby()->events; + call_user_func( + \Closure::bind( + function () use ($events) { + unset($events->processed["permissions.page:check"]); + }, null, $events + ) + ); + + if (!$page->hasPerm()) { + continue; + } + } + if ($page->isDraft() && !($user = kirby()->user() and $user->role()->isAdmin())) { continue; }