Open Toutouwai opened 1 year ago
For the meantime this hook in /site/init.php does the job:
$wire->addHookAfter('PagesRequest::getLoginPageOrUrl', function(HookEvent $event) {
$page = $event->arguments(0);
if($page->template == 'my_template') {
$event->return = $page;
}
});
Then use $page->viewable
logic in the "my_template" template file as per the first post.
Short description of the enhancement
There are currently three options available in the template settings for "What to do when user attempts to view a page and has no access?"
This request is for a fourth option: "Let the template file handle it"
The way that this would work is that for users with no view access, the page would be rendered but
$page->viewable
would be false. So the developer can perform any actions or output whatever they want via the template file.This allows for everything to be self-contained within the template file rather than having to use a separate page ID if you want to render some markup for users with no view access.