For my Marbella news site I recently hired an excellent free-lance writer on Elance to assist me in composing quality articles. As the site is also powered by WordPress I added him as a contributor to start of with. He explained he had some trouble adding images per the guide I sent him. The “Upload/Insert” image button was simply not there.
So to summarise, the WordPress contributor role apparently lacks this permission. There are a few plugins around that can let you tweak those permissions with more granularity, but I just needed that single change.
A bit of searching revealed exactly what I needed. One minor change in the theme’s functions file was sufficient to upload & insert images as a WordPress contributor:
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');
}
This also keeps the core clean for changes which makes upgrading WordPress later on less time consuming.
If you found this post interesting I recommend the following reading:
Copyright © 2010 - scientia potentia est - Log in
Another Calpe Consulting Creation
3 Responses to Upload & Insert images as a WordPress contributor
Phil Harris
April 9th, 2010 at 21:34
Thanks!! This is exactly what I was looking for. A way to make the modification without changing the core files.
Pothi
May 24th, 2010 at 11:12
Thanks for the tip. It works flawlessly. Thanks so much!!!
Jay
June 20th, 2010 at 06:45
Oh my, I love the community that WP has, I’ve found answers to all my questions in the last few days… Thanks for showing me how to do this. I’ve been out of the WP scene for a few months and seemed to have lost my SP skills
Thanks