We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi everyone,
protected pages are still shown on normal outputed pages.
Following changes in Helper/Page/PageHelper.php will fix it as it is similar implemented in ModuleCustomNavigation of Contao core:
<?php namespace Oneup\SiblingNavigation\Helper\Page; class PageHelper extends \Backend { /** * Import the back end user object */ public function __construct() { parent::__construct(); $this->import('BackendUser', 'User'); } public function generateSiblingNavigation($objPage, $type = 'regular', $hidden = '', $unpublished = '', $typeInternal = 'forward') { $prev, $prevPage = null; $next, $nextPage = null; $groups = array(); // Get all groups of the current front end user if (FE_USER_LOGGED_IN) { $this->import('FrontendUser', 'FEUser'); $groups = $this->FEUser->groups; } $published = "published = '1'"; $hide = "hide = ''"; if ('1' === $unpublished) { $published = "(published = '1' OR published = '')"; } if ('1' === $hidden) { $hide = "(hide = '' OR hide = '1')"; } $prevPage = \PageModel::findAll([ 'column' => [ "pid = ?", $published, $hide, "(type = ? OR type = ?)", "sorting < ?", ], 'value' => [ $objPage->pid, $type, $typeInternal, $objPage->sorting, ], 'order' => 'sorting DESC', // no limit due to get all pages for checking protection state //'limit' => 1, ]); while ($prevPage->next()) { $_groups = deserialize($nextPage->groups); if (!$prevPage->protected || BE_USER_LOGGED_IN || (is_array($_groups) && count(array_intersect($_groups, $groups)))) { $prev = $prevPage; break; } } $nextPage = \PageModel::findAll([ 'column' => [ "pid = ?", $published, $hide, "(type = ? OR type = ?)", "sorting > ?", ], 'value' => [ $objPage->pid, $type, $typeInternal, $objPage->sorting, ], 'order' => 'sorting ASC', // no limit due to get all pages for checking protection state //'limit' => 1, ]); while ($nextPage->next()) { $_groups = deserialize($nextPage->groups); if (!$nextPage->protected || BE_USER_LOGGED_IN || (is_array($_groups) && count(array_intersect($_groups, $groups)))) { $next = $nextPage; break; } } return array( 'prev' => $prev ? $this->generateFrontendUrl($prev->row()) : null, 'next' => $next ? $this->generateFrontendUrl($next->row()) : null, 'prevTitle' => $prev ? $prev->title : '', 'nextTitle' => $next ? $next->title : '', 'objPrev' => $prev, 'objNext' => $next, ); } } ?>
I haven't checked if same changes should be made to helper objects for news and events.
Thank you in advance webathlet
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi everyone,
protected pages are still shown on normal outputed pages.
Following changes in Helper/Page/PageHelper.php will fix it as it is similar implemented in ModuleCustomNavigation of Contao core:
I haven't checked if same changes should be made to helper objects for news and events.
Thank you in advance
webathlet
The text was updated successfully, but these errors were encountered: