If filed does not exist, do not allow to change listing status


Sorry for the noob question, and I know that this is a basic functionality, but I can’t wrap my head around this:
I have a member page that I access from the panel. Each member needs a profile image. How can I assure that it exists. Basically, I don’t want to allow member pages (as listed) without a profile image.

Do I have to write a config hook that checks for the file/media->exists() or is there another (easier way) to do this?

Thank you!!!

How is that image added to your member page? Via a files section (then set min: 1), or via a files field (then require it). That way, a page cannot be published without that file being present.

However, in your templates you would have to make sure that image still exists, because it might have been deleted.

Respect, you are quick!!! Kudos for that!!!

file section set min:1 did the trick
But, I see that checking the template is good coding practice, BUT generally I cannot examine how I should run into this problem (other than if I delete the avatar manually in the folder). I cannot store the model change if size of files < 1?

Thanks for the clarification!

I don’t really understand what you mean? Could you please rephrase?