I would like to display the name of the user who last edited a page, maybe something like this:
editor:
label: Editor
type: user
readonly: true
override: true
Is it possible?
Thanks
I would like to display the name of the user who last edited a page, maybe something like this:
editor:
label: Editor
type: user
readonly: true
override: true
Is it possible?
Thanks
This can be achieved by setting the value of this field programmatically with the panel.page.update hook.
OK, thanks.
I will have to read up on how to use hooks…
Alright. Don’t hesitate to ask if you run into any problems.
I did that before… here you go…
// in config.php
kirby()->hook(['panel.page.create', 'panel.page.update'], function($page) {
if($page->template() == 'templateWithEditor' ||
$page->content()->has('editor') ||
$page->editor()->isEmpty()) {
try{
$page->update([
'editor'=>site()->user()->username()
]);
}
catch(Exception $ex) { }
}
});
you could also use
or
btw… what does override: true do? can not find it in the docs.
@texnixe Is it possible to display kirby-logger values on the front-end? I can’t find any information on it in the forum.
Yes, you could do that. All data is saved to a log file. It’s not an official function of the plugin, but you can use the tail() function of the plugin to get the data on the frontend.