Apply restrictions to file uploaded manually via code

Viewing 4 posts - 1 through 4 (of 4 total)
#210360

Hi, I have a form with a input file. When it is sent I upload the file to media library. I want this file to be restricted to subscriber role, so it has no public access.

I have found this in database:

update_post_meta($attachment_id, ‘__wpdm_private’, 1);
update_post_meta( $attachment_id, ‘__wpdm_media_pass’, ”);
update_post_meta($attachment_id, ‘__wpdm_media_access’, [‘subscriber’]);

But it is still public accessible.
What more do I have to do to restrict it?

Thank you.

#210361

Tahasin
Moderator

Hello,

Thanks for reaching out.

We recommend uploading your files through Select File option, as this will allow the download manager to handle the file with proper access level properly.

For media file protection, please read the documentation from this page: https://www.wpdownloadmanager.com/how-to-protect-wordpress-media-library-files/

If you have further queries, feel free to ask.
Regards

#210362

There is no other way? I know how to do it inside WordPress, but in this case I need to do it manually with PHP.

#210363

Tahasin
Moderator

We have verified that the media protection is functioning as expected.
To help us investigate this further, could you please share the login credentials in a private reply?

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.