0

What I'm trying to learn is to remove multiple upload (and drag&drop). I want a user (vendor) should be able to upload only one file when clicks on upload button. Instead of completely removing drag&drop feature I would like to limit it depending on user role. There were several codes for it but they were all about limiting upload size and total upload count of a user. For example right now a vendor is able to drag&drop 100 files and it would be really bad.

Please help.

Thank you.

0

This is a bit out of context but I think you can approach it a little bit differently, you can limit access to default media library for roles below "admin" or "editor" depending on your setup. For instance you can block authors from uploading files to media library using the following code..

if ( current_user_can('author') && current_user_can('upload_files') )
add_action('admin_init', 'remove_author_uploads');

function remove_author_uploads() {
    $author = get_role('author');
    $author->remove_cap('upload_files');
}

Then allow them to upload to media library from a front-end page on the site. Here is a good reference to that How can I add an image upload field directly to a custom write panel?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.