Job poster has access to all media items

Ticket for: Job Board Manager
0
Job poster has access to all media items 1
Martin Sauter
Sep 17, 2019 10:10 PM 2 Answers
Member Since Aug 2019
Subscribed Subscribe Not subscribe
Flag(0)

When a job poster adds a company logo, he has acess to all items in the media library. That's not the way it should be, he should only see his own media items. (This might even be a security issue since some media items could be confidential.)

2 Subscribers
Job poster has access to all media items 1
Job poster has access to all media items 3
Submit Answer
Please login to submit answer.
2 Answers
Sort By:
Best Answer
1
Job poster has access to all media items 4
PickPlugins
Sep 18, 2019
Flag(0)

Welcome to our forum.

I just try your suggestion, found the solution here,

https://wordpress.stackexchange.com/questions/1482/restricting-users-to-view-only-media-library-items-they-have-uploaded

you can add following code to restricted other files.

add_filter( 'ajax_query_attachments_args', 'show_current_user_attachments' );

function show_current_user_attachments( $query ) {
    $user_id = get_current_user_id();
    if ( $user_id ) {
        $query['author'] = $user_id;
    }
    return $query;
}

Regards

Job poster has access to all media items 5
Martin Sauter
- Sep 18, 2019 06:04 PM
Flag (0)
0

This works fine, thank you.

I think this should be the standard behaviour of your plugin. It's very irritating if you publish a job for company A and see the logo of company B (and maybe many other files) in the media library.

Sign in to Reply
Replying as Submit
Best Answer
0
Job poster has access to all media items 4
PickPlugins
Sep 17, 2019
Flag(0)

Welcome to our forum.

Don't worry, media uploader only display public files, not secured or hidden files, basically, any user can access your public file via url. Hope you understand.

Regards

Job poster has access to all media items 5
Martin Sauter
- Sep 18, 2019 06:06 PM
Flag (0)
0

Yes, I know that media files are not truely protected by the code you have posted above. But it's a good enough solution for our needs.

Sign in to Reply
Replying as Submit