zartgesotten
11/30/2017 - 2:10 PM

Allow Subscriber to upload files

Used for Members Area

<?php
if ( current_user_can( 'subscriber' ) ) {
    add_action( 'load-profile.php', 'wp_enqueue_media' );
 
    if( ! current_user_can( 'upload_files' ) ) {
        add_action('admin_init', 'allow_subscriber_uploads');
    }
}
 
function allow_subscriber_uploads() {
    $subscriber = get_role('subscriber');
    $subscriber->add_cap('upload_files');
}
?>