Hello, I created a custom ‘editor’ role. Everything’s good, but I can’t upload a avatar. My role is the following
<?php
// Modify 'Editor' role to allow management of site options
return [
'name' => 'Editor',
'default' => true,
'permissions' => [
'*' => true,
'panel.user.*' => false,
'panel.user.read' => true,
'panel.user.update' => function() {
if($this->user()->is($this->target()->user())) {
// users are allowed to edit their own information
return true;
} else {
// other users can't be edited
return false;
}
}
]
];
Any insight?
Can you upload avatars without there role settings?
Maybe it has nothing to do with the role. I assumed it did because the issue seemed to appear after I was fussing with creating this editor role. And I can upload images elsewhere in the panel. I just can’t seem to add images to the user’s profile page.
Are you on a Windows system? On Windows the avatar upload does not work…
Do you have any settings in your site.yml blueprint that does not allow image upload?
My local computer is Windows. It didn’t work there. But I just pushed it all live to the remote server. That is not Windows. There are no restrictive settings on the blueprint. See below.
title: Page
pages: true
files: true
fields:
title:
label: Organization Name
type: text
So not avatar upload and no site images upload on the remote server, but uploads to normal pages still working as expected on the remote server?
Sorry for the misstep. I corrected my post above. I can upload images throughout the entire panel (pages, site page, etc.), but not the user’s profile page. I can not upload a image for the user. When I select the image from my computer it never shows up.
Does the avatar folder exist (/assets/avatars)?
Nope.
I added the avatars folder and guess what? It works.
Thanks for your time in helping me out.
Why are suddenly all these avatar folders missing?
1 Like
Are you asking me directly or is this happening elsewhere in the community?
To answer the question I’m creating my own custom starterkit. I ditched anything I felt I didn’t need. For example the ‘assets/fonts’ and obviously the ‘assets/avatars’ folder.
It had happened to someone else the other day. I guess you deleted the folder after setting up the Panel? Usually, the Panel installer complains if the folder is missing… But maybe we need another check if avatar folder deletion becomes a hobby.
Whether it becomes a hobby or not – I think it’s a good idea to throw an precise error message when the avatar upload fails because of this: Show error message if avatar upload fails due to missing /assets/avatars/ · Issue #1021 · getkirby-v2/panel · GitHub
1 Like
Just to confirm, I did remove the ‘avatars’ folder after install. It seemed no more important than the fonts folder. And I, like I’m sure many other minimalist Kirby lovers, ditch what is not “needed” so I can understand how that issue may come up from time to time. An error message would nip this in the bud.