Skip to content

Commit a1bc39e

Browse files
committed
Allow users to access drafts. Closes #4
1 parent 4ca2e32 commit a1bc39e

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

index.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@
2121
foreach(option('sylvainjule.bouncer.list') as $role => $options) {
2222
if($currentRole == $role) {
2323
$fieldname = $options['fieldname'];
24-
$pages = $currentUser->$fieldname()->toPages();
24+
// can't use ->toPages() here because it won't include drafts
25+
$pages = $currentUser->$fieldname()->yaml();
26+
$pages = array_map(function($p) use($kirby) { return $kirby->page($p); }, $pages);
27+
$pages = new Pages($pages);
2528
$nav = array_key_exists('nav', $options) && $options['nav'] ? $options['nav'] : false;
2629

2730
if($pages->count()) {

0 commit comments

Comments
 (0)