ProcessWire access controls, roles and permissions
<?php
/**
* if link_type is page, check selected page_link for access permission,
* if not, check "home page" for access permission, (access is granted).
*
* To check if page is viewable use: <?php if($pageAccess->viewable()) : ?>
* Note: PAGE_LINK TEMPLATE MUST HAVE TEMPLATE FILE, if not item won't be visible
*
*/
$pageAccess = "";
$pageAccess = $pages->get("/");
if($link_type == '2' && !empty($page_link)) {
$pageAccess = $pages->get("id=$page_link");
}
if($pageAccess->viewable()) {
// you can view the page
}