Allow Contributors to Upload Files
I would like to allow contributors to upload a file. So I use this recommended plugin WP Role Editor
After activated, I go to the plugin from User User Role Editor
and then select contributor in the selection dropdown. After that I put a check on upload_files
and hit update. Then, I login with contributor account to test uploading a file. Great, I see the media upload button but when I click to upload a file, I get this error:
Sorry, you are not allowed to attach files to this post
I posted a question about this in their support forums but the plugin author hasn't given a solution.
Now, I tried the code below that I've found in Google. However, it doesn't show the upload media button at all.
// Let Contributor Role to Upload Media
if( current_user_can( 'contributor' ) ! current_user_can( 'upload_files' ) )
add_action( 'admin_init', 'allow_contributor_uploads' );
function allow_contributor_uploads() {
$contributor = get_role( 'contributor' );
$contributor-add_cap( 'upload_files' );
}
So, what else can I do to get this done? Why doesn't WordPress allow Contributor role to upload a files? According to the theme I use, I have to set this role by default for register users if I want users to submit a post with approval.
Topic user-roles users Wordpress
Category Web