WORDPRESS: ALLOW CONTRIBUTORS TO UPLOAD FILES

Lot of contributors suffered from this problem. They can’t able to upload any kind of files through their dashboard. I also got lot of complaints regarding this. So just thought of sharing this.

Actually there are two ways to allow contributors to upload files. Either you can try a WordPress plugin (Recommended) or try some coding.

But personally I prefer the WordPress plugin method. Through which you can increase the capabilities of contributors.

A Contributor is somebody who can write and manage their posts but not publish them.

1. WordPress Plugin – Capability Manager

Capability Manager

#1. Install and activate Capability Manager Plugin.

#2. Go to Users | Capabilities.

#3. Select Capabilities for Contributor|User role.

#4. Check Upload Files and Save.

2. Paste the following Code in functions.php

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

Just paste the above code snippet in your theme’s functions.php file and for thesis users, just copy and paste the code in custom_functions.php file.

First of all, make sure you take a backup of functions.php or custom_functions.php file before implementing this tutorial. Play it safe.

0 comments:

Post a Comment