• Resolved Angela

    (@angelazou)


    Hi,

    I need to grant the upload file capability to all contributor users in WordPress. I understand that this will involve either the current_user_can or add_cap function, but I don’t know what file is designated to assign capabilities to users. What file should I tweak the settings?

    I saw a sample configuration on the Codex page, and I’ve created the following excerpt:

    function add_contrib_caps() {
    $role = get_role( ‘contributor’ );
    $role->add_cap( ‘upload_files’ );
    }
    add_action( ‘admin_init’, ‘add_contrib_caps’);

    I looked up admin_init, and it’s suppose to run before the back end panel starts. So, perhaps I should place the function in the admin.php?

    Angela

Viewing 2 replies - 1 through 2 (of 2 total)
  • Do you need to include the function in your theme, or would you be willing to use a plugin solution? This plugin may offer you a more granular (and easy access) control for all of your user role capabilities. It might be worth a look as an alternative solution, if you aren’t opposed to the plugin idea.

    https://www.ads-software.com/extend/plugins/user-role-editor/screenshots/

    Thread Starter Angela

    (@angelazou)

    I placed the function into functions.php, where there was a list of admin_inits. A plugin would be fine, except that I was suppose to make changes to all contributors, so this might be a little easier. Thanks.

    Angela

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Grant Contributor to Upload Files’ is closed to new replies.