• Resolved Bence

    (@charybdis)


    Hi,
    I have a contributor user who can upload files into the media library.
    That works, however I want to prevent this contributor user from editing and deleting even his/her own files which were uploaded to the media library.

    By default if I grant the upload_files capability to a contributor user, then this contributor user will be able to edit and delete the attachments created by this user. But I want to prevent that. Is it even possible?

    I read this: https://themehybrid.com/plugins/members-core-create-caps#faqs

    Currently, there’s a bug in core WordPress that prevents users from having only the create_posts or create_pages capability. You’ll need the edit_posts or edit_pages capability to go along with that.

    Is is still true? I tried it, and unfortunately it doesn’t work. So I granted the create_posts capability to a contributor and denied the edit_posts and delete_posts capability, then the contributor won’t be able to edit and delete attachments, however then the add new post option will not work.

    Basically I need someting like this: https://www.role-editor.com/prohibit-authors-attachments-deletion/

    So introduce the ‘edit_attachments’ and ‘delete_attachments’ capabilities separately for the attachment post types only, to separate these capabilities from the edit_posts in case of the attachment post type.

    Is it possible with Members? If not, do you know a custom code which could do this?

Viewing 1 replies (of 1 total)
  • Plugin Author Caseproof

    (@caseproof)

    Hi Bence,

    ?I apologize for the delay in response.

    I was trying to achieve what you want, but I’m afraid that allowing users to upload files without editing them requires custom development.

    Best

Viewing 1 replies (of 1 total)
  • The topic ‘How to prevent a user role from editing and deleting attachments?’ is closed to new replies.