Media Library results filtered by user

in flag

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?

id flag
I feel like I’ve seen this question asked recently, here or on
cn flag

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
John Machado avatar
in flag
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.
cn flag
If you have the contextual filter set up on the same view then I'd suggest that's a bug
cn flag
Looks like Entity Browser does some extra contextual filtering (, so that might be the cause of the problem
John Machado avatar
in flag
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.

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.