Page List viewing permissions (like auto nav)

Permalink
I have a site with a section of press releases that are for registered-users only. However, I'd like to show the first few titles/descriptions on the homepage as a taster, but the page list will hide them based on inherited permissions.

Even with advanced permissions on the page-list block, I can't this to display for guests.

The AutoNav "Display pages to users even when those users cannot access those pages." option would be ideal here.. has anyone been able to do this?

moth
View Replies:
MiZtrOh replied on at Permalink Reply
MiZtrOh
Yes, you can do this. Check out the PageList page in the concrete5 API:

http://concrete5.org/api/Pages/PageList.html...

There's a method for the class that toggles permission-based filtering.

$pl = new PageList();
$pl->displayOnlyPermittedPages(false);


Voila.
dforst replied on at Permalink Reply
I just thought I'd update this thread, since I spend the better part of the morning unnecessarily hacking the page list block to display restricted pages.

I am using (and recommending here) the excellent Featured Content Slider Page List Templates by c5mix, very happy to pay a little for a lot of time saved.

Anyway, here's what I did (if this is not best practice, please correct me ASAP)

1. Copy concrete/models/page_list.php to models/page_list.php
2. Set
protected $ignorePermissions = false;
to
protected $ignorePermissions = true;


That's it. I wasn't aware that this was possible till I started to hack the page-list block. I hope this saves someone some time, it's not uncommon to need to front restricted content in order to generate revenue.

Question for core team:

protected $displayOnlyPermittedPages = false; // not used.


Why not used?
moth replied on at Permalink Reply
moth
Nice one.
moth replied on at Permalink Reply
moth
But of course it would be better with a switch in the Page List UI.
pburgo replied on at Permalink Reply
Hi dforst,

I don't see protected $ignorePermissions = false; in the concrete/models/page_list.php file.

This is what's in the file that I can see:
<?php

defined('C5_EXECUTE') or die("Access Denied.");
class PageList extends Concrete5_Model_PageList {}
class PageSearchColumnSet extends Concrete5_Model_PageSearchColumnSet {}
class PageSearchDefaultColumnSet extends Concrete5_Model_PageSearchDefaultColumnSet {}
class PageSearchAvailableColumnSet extends Concrete5_Model_PageSearchAvailableColumnSet {}

Am I missing something?

Thanks,
Paul
dforst replied on at Permalink Reply
No, you're not missing anything. That hacky solution applied to an older version of Concrete5.

What are you trying to accomplish?
pburgo replied on at Permalink Reply
Thanks for the reply. It is much appreciated.

I have pages that are restricted to registerd users. I need to display a page list that shows a listing of all the page links to guests, but when they click the link, because of the permission settings, it will take them to a login/register page.

Currently the page list will not show links that have premissions set to registerd users unless the user is logged in. So it would be much like the setting in the autonav block - "Display pages to users even when those users cannot access those pages"

I think thats clear....if not let me knwo
dforst replied on at Permalink Reply
I am not sure how to do this in the latest version of Concrete5. Maybe somebody else has already done this? If not, I'll take a look towards the end of the week.
pburgo replied on at Permalink Reply
Thanks
StefanV replied on at Permalink Reply
Good day

Did you ever find a solution to this request?