willowf's picture

Hi everyone,

I’m trying to restrict the image library in BackdropCMS so that when a user selects a profile picture, they can only choose images from public://avatars/.

I managed to achieve this by adding a filter in the perfil_image_library view, but this change affects other content types that also use the image browser.

What I need is:

  1. In the user profile form, users should only be able to select images from public://avatars/.
  2. In other forms, the image library should work without restrictions.

I’ve tried modifying the user_picture_field module using hook_views_query_alter(), but it hasn’t worked as expected. I also attempted using hook_form_alter(), but it still affects other parts of the site.

What would be the best way to restrict the image library only when selecting a user profile picture, without impacting other forms?

Thanks in advance for any suggestions!