I am working on a project that will be using 100's users and potentially thousands of users. The users will be required to upload at the very least 5 images and possibly some PDF files.

Created a content type, and added some Media fields, which works perfect for this project. The user files uploaded will be all public but the issue is that when the user goes to browse for their files all files from all users are listed and available. Once the site reaches a high level of users, browsing hundreds if not thousands of images and/or files is just not ideal.

How can I filter the Media browser to only show the files that user uploaded?

  • I feel like I’ve seen this question asked recently, here or on drupal.org.
    – mona lisa
    Jun 1, 2022 at 11:08

1 Answer 1


That should be quite straightforward to set up:

  1. Add a contextual filter to the View which powers the Entity Browser
  2. Choose "Authored by" as the field
  3. Under When the filter value is not available, choose Provide default value
  4. In that dropdown, select User ID from logged in user
  • I added the contextual filter to the views Media & Media Library and that works when viewing the media page, but not when the user browses the library, all three test images, uploaded by three different users all show up. Under >Structure>Views>Media Library I even applied it to all the widgets. Nothing changed on the file browser. Jun 1, 2022 at 11:35
  • If you have the contextual filter set up on the same view then I'd suggest that's a bug
    – Clive
    Jun 1, 2022 at 11:36
  • Looks like Entity Browser does some extra contextual filtering (drupal.org/project/entity_browser/issues/2865928), so that might be the cause of the problem
    – Clive
    Jun 1, 2022 at 11:38
  • Well, to complicate things I decided to clear all caches and rebuild all permissions. With the contextual filter enabled as above on the view 'Media Library' on all pages of the view, no media shows up at all for all users, you can upload images but they will not show, yet they are uploaded into Media content. If I remove the contextual filter from all pages of the Media Library view, every user can see every media file. Permissions are all set for Media to have edit, create, and view "own", so everything there looks good. Jun 1, 2022 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.