fix user authorized projects custom methods
This commit is contained in:
parent
ef6375f4cc
commit
699c0bfa1d
4 changed files with 29 additions and 23 deletions
20
public/site/plugins/user-projects/index.php
Normal file
20
public/site/plugins/user-projects/index.php
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
|
||||
Kirby::plugin('adrienpayet/pdc-authorized-projects', [
|
||||
'userMethods' => [
|
||||
'currentProjects' => function() {
|
||||
if ($this->role() == 'admin') {
|
||||
return page('projects')->children()->listed();
|
||||
} else {
|
||||
return $this->projects()->toPages()->listed();
|
||||
}
|
||||
},
|
||||
'archivedProjects' => function() {
|
||||
if ($this->role() == 'admin') {
|
||||
return page('projects')->children()->unlisted();
|
||||
} else {
|
||||
return $this->projects()->toPages()->unlisted();
|
||||
}
|
||||
},
|
||||
]
|
||||
]);
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<?php
|
||||
|
||||
Kirby::plugin('adrienpayet/pdc-your-projects', [
|
||||
'userMethods' => []
|
||||
]);
|
||||
Loading…
Add table
Add a link
Reference in a new issue