Trying to hide 'hidden' pages from next/prev block.
Permalink
Trying to hide 'hidden' pages from next/prev block.
I'm using 5.5.2.1. I have 'Exclude from Nav', and 'Exclude from Page list' checked in page attributes, and 'Exclude system pages' checked in the block itself. Cleared site + browser cache, but the hidden pages still appear. I am not overriding the core block.
I can get round it using advanced permissions, but this isn't ideal as is a bit confusing for end client.
Anyone know how to get round this?
I'm using 5.5.2.1. I have 'Exclude from Nav', and 'Exclude from Page list' checked in page attributes, and 'Exclude system pages' checked in the block itself. Cleared site + browser cache, but the hidden pages still appear. I am not overriding the core block.
I can get round it using advanced permissions, but this isn't ideal as is a bit confusing for end client.
Anyone know how to get round this?
It is one of the core add-ons that comes as standard with C5.
I would be interested in a solution too. Maybe excluding pages with the attribute 2exclude from nav" could be done with an custom template for the prev-next block?
Anyone found a solution to this?
Check my solution below.
Hi guys, after having an issue with this myself, it's a ridiculously easy fix.
I'm using 5.5.1 on this current website with this issue.
if you go to root/concrete/blocks/next_previous/controller.php
Look at lines 90-104:
All we need to do is add:
after
Add as many filters to this as you want and job done by default. Obviously, you should probably modify the form so that you can tick to exclude the ones that are exclude from nav, exclude from pagelist etc.
I'm using 5.5.1 on this current website with this issue.
if you go to root/concrete/blocks/next_previous/controller.php
Look at lines 90-104:
protected function loadOtherCollections(){ global $c; $pl = new PageList(); if ($this->orderBy == 'chrono_desc') { $pl->sortByPublicDateDescending(); } else { $pl->sortByDisplayOrder(); } $pl->filterByParentID( $c->cParentID ); if($this->excludeSystemPages) $this->excludeSystemPages($pl); $this->otherCollections = $pl->get(); $this->otherCollectionsLoaded=1; }
All we need to do is add:
$pl->filterByAttribute('exclude_page_list', 0);
after
$pl = new PageList();
Add as many filters to this as you want and job done by default. Obviously, you should probably modify the form so that you can tick to exclude the ones that are exclude from nav, exclude from pagelist etc.
Thank you for sharing, unfortunately i don't see such code in Concrete5 5.6.3.1.
Hi Okapi, I did say that this was a fix for the issue in 5.5.1, 5.6.x has a different issue that needs to be solved, but I'm looking into that too.
On 5.6.1 (This is our dev version we use, but should be in 5.6.3 too)
Open up: root/concrete/core/controllers/blocks/next_previous.php
Change lines 94 and 130 from
That should fix the issue for you, and thus anything that is hidden from a pagelist, should now be hidden from a next/prev too!
Open up: root/concrete/core/controllers/blocks/next_previous.php
Change lines 94 and 130 from
if ($cp->canRead() && $page->getAttribute('exclude_nav') != 1) {
if ($cp->canRead() && $page->getAttribute('exclude_nav') != 1 && $page->getAttribute('exclude_page_list') != 1) {
That should fix the issue for you, and thus anything that is hidden from a pagelist, should now be hidden from a next/prev too!
This is a quick fix, but i think a more robust fix would be a quick rewrite of the sql which I'll do at a later date
Citytech