Group Permission of a Page for a page list

I would like to say Yes this page is for people who are registered, in a page list.

The idea is that I have a page list and then highlight all the page that you would need have an user account to view. Ie “Member Only Pages”

Logic being

does this page exclude guests from viewing and is only for registered users…
then give it a RED link

If anyone can see it dont.

@TMDesigns Sounds like some permissions based options that need to be added to my page list package :D. Interesting thoughts here. I’ll be pondering and watching the conversation. Let you know if I have any ideas!

off the top of my head, you could create a custom page list template, where you loop through the pages in the list, checking their permissions and then output using classes to style the links appropriately…

This was what I would do…

I have this which @mesuva pointed out to me.

I will give it a try.

So after a bit of help from @mesuva I have it.

<?php

$guestGroup = \Concrete\Core\User\Group\Group::getByID(1);
$entity = \Concrete\Core\Permission\Access\Entity\GroupEntity::getOrCreate($guestGroup);
$key =  \Concrete\Core\Permission\Key\Key::getByHandle('view_page');

foreach ($pages as $page) {

        $key->setPermissionObject($page);
        $access = $key->getPermissionAccessObject();
        $isPublic = $access->validateAccessEntities(array($entity));
};
?>


 <?php if ($isPublic){?>
            //Do something like: 
            <span>MEMBERS ONLY</span>
  <?php } ?>

2 Likes