fix user authorized projects custom methods

This commit is contained in:
isUnknown 2024-11-22 07:27:11 +01:00
parent ef6375f4cc
commit 699c0bfa1d
4 changed files with 29 additions and 23 deletions

View 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();
}
},
]
]);

View file

@ -1,5 +0,0 @@
<?php
Kirby::plugin('adrienpayet/pdc-your-projects', [
'userMethods' => []
]);