I believe as default WordPress won't allow author to upload image via Media button on TinyMCE. It will give you You don't have permission to attach files to this post.
error message if you do.
I'm working on a plugin that will allow authors to write and upload images from TinyMCE and looking for solution to grant permission to author to upload images.
How do I achieve this without using other plugins?
Update
I have added below code on my plugin file and it somehow made author to upload image from frontend via Add Media button. However, I'm not quite sure what it really did.
I remember seeing that WP stored role capability data in DB. I'm assuming one of below code save setting for Author and it works after that?
function wh_edit_roles(){
if ( current_user_can( 'edit_posts' ) ){
$user = new WP_User(get_current_user_id());
$user->add_cap('edit_post');
$user->add_cap('edit_others_pages');
$user->add_cap('edit_published_pages');
}
}
add_action('wp_head', 'wh_edit_roles');