Post Pic

WordPress tip: Allow contributors to upload files

If you have contributors to your blog, you probably got annoyed to see that they can’t upload files and images while writing guest posts for you. Today’s recipe will solve the problem, allowing contributors to upload files to your blog.

Nothng hard with this code: The only thing you have to do is to paste it in your functions.php file:

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');
}

Big thanks to Altaf Sayani for his contribution to WpRecipes!

3 Responses

Jan 02 2012 19:05

Nothing hard? I copied it to my functions.php and the follow error was reported:

Parse error: syntax error, unexpected ‘&’ in /hermes/web03/b398/pow.nandito98/htdocs/blog/portugal/wp-content/themes/arthemia/functions.php on line 12

What to do? Every link I click dont open…

Apr 05 2012 16:57

@Nando Kindly download and activate Advance permalink to fix the error :)

Jan 15 2013 08:36

I am having the same problem Nando had. I cannot access plugins to download Advance permalink. I get the following error any time I try to click any link on the dashboard so even if I install via ftp I still wouldn’t be able to activate it:
Parse error: syntax error, unexpected T_ENDIF in /home/dmacc/legacyboom.org/wp-content/themes/twentyeleven/functions.php on line 603

Please help! Thank you!

Trackbacks:

Leave a Comment

* Name, Email, Comment are Required

WP Theme of the week

Sponsored Likebox