Change WordPress user roles and capabilities › Forums › Restrict or Permit access inside WordPress – how to › Post Edit Access: Granting other users access to uploaded media files
- This topic has 4 replies, 2 voices, and was last updated 5 years ago by curtin-webteam.
-
AuthorPosts
-
22/10/2019 at 07:15 #6057curtin-webteamParticipant
Hi,
Regarding files in the Media Library, is there a way to securely enable other user(s) to list/see files another user has uploaded?
We currently use the “Post Edit Access” feature to lock down pages by Category Id. As a result of this restriction, I’ve noticed that when a user uploads a file in the media library, another user cannot see the file when they browse the media library.
Is there a setting I can utilize to enable another user to see media files another user has uploaded and intends sharing?
A simple use case of this is:
1. An administrator uploads a document to the Media Library and intends sharing this with a Publisher,2. The Publisher logs into WordPress and browses the media library
3. Currently, it seems the Publisher isn’t able to see that uploaded document.
22/10/2019 at 14:15 #6058VladimirKeymasterHi,
The custom filter ure_attachments_show_full_list helps to resolve this.
24/10/2019 at 07:23 #6061curtin-webteamParticipantThanks Vladimir. I’ve tried that code and it lists all attachments, which is fine as a first step.
The only issue is that, for my use-case I don’t want the user seeing all attachments. I would only like the user to see attachments belonging to their team.
I was wondering if I could categorize media files and using the “”Posts Edit Access” feature to allow users to see shared media files “team-name-categorized” files as follows:
1. Enable categories for media library files using the code: register_taxonomy_for_object_type(‘category’, ‘attachment’)
2. Create a new category called “departmentAfiles”, and assign the category to a media file. The category would only be used to categorize shared files only for department A’s members.
3. Copy the category ID of “departmentAfiles” into the “Posts Edit Access” field “with category/taxonomy ID” – for department A’s role within User Role Editor
Basically, is there a way of applying the “Posts Edit Access” feature “”with category/taxonomy ID”” restriction to media files just like it works for pages?
Thanks.
25/10/2019 at 04:30 #6072VladimirKeymasterIs there a way of applying the “Posts Edit Access” feature “”with category/taxonomy ID”” restriction to media files just like it works for pages?
No, it will not work as you wish.
Code is built such way, that 1st it defines what posts/pages/CPT are available for editing, only then it extracts the list of attachments for which those posts are parent. Attachments are not processed as an independent post type. So general scheme will not work for them.31/10/2019 at 06:09 #6082curtin-webteamParticipantThanks Vladimir, that explains it. Looks like the key thing is ensuring the media file is attached to a page. Put simply, the feature works for attached files, but not designed to apply to unattached files. This works for my use-case, cheers.
-
AuthorPosts
- You must be logged in to reply to this topic.