Apply restrictions to file uploaded manually via code

in Download Manager Free

Viewing 4 posts - 1 through 4 (of 4 total)
Dec 31, 2025 at 9:57 am
#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.

Dec 31, 2025 at 10:09 am
#210361
Moderator
Tahasin
Staff

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

Dec 31, 2025 at 10:13 am
#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.

Dec 31, 2025 at 10:16 am
#210363
Moderator
Tahasin
Staff

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.