Subsite permission to upload files

Hey there,
I'm absolutely loving your plugins :slight_smile:

I have a small problem however.
I can upload images just fine - but my subsites cannot.

When i go to add or edit a post/page the 'ADD MEDIA' button does not show. When i click featured image a box pops up and says that i do not have permission to upload files.

I have prosites installed as well as nearly all of your plugins. i disabled all but the prosites plugin and this still didn't help
I'm not sure where i'm going wrong?

would love some help :slight_smile:

Thanks so much

Casey Jones

  • Alexander
    • DEV MAN’s Mascot

    Hi @sticktrix1,

    Can you try doing an upload as the super admin account on any sub site? Let me know if you still get this message. Also, could you copy/paste the exact error message, or post a screenshot?

    It sounds like the permissions might not be setup properly on your uploads folder. This is a pretty straightforward thing to fix, but we'd need to confirm this first. Then I can help you with the permissions. The WordPress codex covers the proper permission structure here as well: http://codex.wordpress.org/Changing_File_Permissions

    Best regards,

  • sticktrix1
    • Design Lord, Child of Thor

    Thanks for your reply Alex, i'm familiar with how to change permissions in cpanel. However, i'm unsure of what folder/s i would need to change and what they would need to change to.

    I have attached two screen shots - one you can see clearly that in the background on the left the 'ADD MEDIA' button IS there. (super admin uploading media on the subsite)

    and the other screen shot is logged in as the subsite user. Notice - No Add Media button and the permissions error is displayed after clicking the (Add facebook image) button.

  • Brashell
    • The Bug Hunter

    Ok, I just dealt with this, its all taken care of now though. Please locate wp-admin/includes/schema.php and look for // Add caps for Subscriber role around line 650 (I have added code to mine so its a bit different) under
    // Add caps for Subscriber role
    $role = get_role('subscriber');
    replace
    $role->add_cap('read');
    $role->add_cap('level_0');

    with:

    $role->add_cap('upload_files');
    $role->add_cap('edit_posts');
    $role->add_cap('edit_published_posts');
    $role->add_cap('publish_posts');
    $role->add_cap('read');
    $role->add_cap('level_2');
    $role->add_cap('level_1');
    $role->add_cap('level_0');

    (Yes its the same as author)

    if you need help let me know, it might be difficult or to complex for you. Cheers - Brandon

  • sticktrix1
    • Design Lord, Child of Thor

    Cleared browser, made a new site through the front end sign up.

    Still the same problem, "You do not have permission to upload files." and no 'ADD MEDIA' Button on posts/pages or anywhere.

    I went through and changed permissions of wp-content, uploads and sites to 777. didn't make any difference.

    I'm not sure what it could be - it works fine for super admin

  • sticktrix1
    • Design Lord, Child of Thor

    Oh that's absolutely fine, Hopefully it was a sunny day and it all went well :smiley:

    I was using a lot of plugins - i decided to do a test with all the plugins deleted from the plugins directory
    This didn't make a difference so i added them back.

    I'm using pro sites now along with easy blogger, custom blog etc.

    I can upload images as SuperAdmin on these sites, but when i log out and login to these sub sites as a normal Admin i can't.

  • Brashell
    • The Bug Hunter

    Please check that these are the current capabilities that are set in the schema. They are in the same file as before.

    // Add caps for Administrator role
    $role = get_role('administrator');
    $role->add_cap('switch_themes');
    $role->add_cap('edit_themes');
    $role->add_cap('activate_plugins');
    $role->add_cap('edit_plugins');
    $role->add_cap('edit_users');
    $role->add_cap('edit_files');
    $role->add_cap('manage_options');
    $role->add_cap('moderate_comments');
    $role->add_cap('manage_categories');
    $role->add_cap('manage_links');
    $role->add_cap('upload_files');
    $role->add_cap('import');
    $role->add_cap('unfiltered_html');
    $role->add_cap('edit_posts');
    $role->add_cap('edit_others_posts');
    $role->add_cap('edit_published_posts');
    $role->add_cap('publish_posts');
    $role->add_cap('edit_pages');
    $role->add_cap('read');
    $role->add_cap('level_10');
    $role->add_cap('level_9');
    $role->add_cap('level_8');
    $role->add_cap('level_7');
    $role->add_cap('level_6');
    $role->add_cap('level_5');
    $role->add_cap('level_4');
    $role->add_cap('level_3');
    $role->add_cap('level_2');
    $role->add_cap('level_1');
    $role->add_cap('level_0');

  • sticktrix1
    • Design Lord, Child of Thor

    Looks the same to me?

    // Add caps for Administrator role
    $role = get_role('administrator');
    $role->add_cap('switch_themes');
    $role->add_cap('edit_themes');
    $role->add_cap('activate_plugins');
    $role->add_cap('edit_plugins');
    $role->add_cap('edit_users');
    $role->add_cap('edit_files');
    $role->add_cap('manage_options');
    $role->add_cap('moderate_comments');
    $role->add_cap('manage_categories');
    $role->add_cap('manage_links');
    $role->add_cap('upload_files');
    $role->add_cap('import');
    $role->add_cap('unfiltered_html');
    $role->add_cap('edit_posts');
    $role->add_cap('edit_others_posts');
    $role->add_cap('edit_published_posts');
    $role->add_cap('publish_posts');
    $role->add_cap('edit_pages');
    $role->add_cap('read');
    $role->add_cap('level_10');
    $role->add_cap('level_9');
    $role->add_cap('level_8');
    $role->add_cap('level_7');
    $role->add_cap('level_6');
    $role->add_cap('level_5');
    $role->add_cap('level_4');
    $role->add_cap('level_3');
    $role->add_cap('level_2');
    $role->add_cap('level_1');
    $role->add_cap('level_0');

  • sticktrix1
    • Design Lord, Child of Thor

    Another thing - i'm not sure if there is supposed to be a form in the /wp-admin/options-media.php page for where the uploads go to?

    in the uploads/sites folder there are folders created for each test subsite - but obviously no images can be uploaded unless 'Super Admin' uploads them.

  • Alexander
    • DEV MAN’s Mascot

    Hi @sticktrix1,

    I'm sorry for the delay in getting back to you here.

    I would not at all advise changing any of the Wordpress core files. I would recommend replacing the wp-admin/includes/schema.php file with a fresh copy downloaded from wordpress.org

    You should never have to modify code Wordpress files, and doing so could cause other problems.

    Is see this is a capability issue however, but there are other ways to fix it.

    First, I would recommend creating a new wordpress account on this site and changing the role to administrator. Log in as that new account and see if you can upload files. If so, you'll know that we have a problem with the other account specifically and not the overall role.

    To fix the other account, you can try this:

    - Use the new admin account and change the old one to a subscriber role.
    - Save these changes.
    - Then log into the old account to confirm it's a subscriber, then Log back out
    - Use the admin account to promote the old one back to an admin again.

    This should essentially cause that users capabilities to be rebuilt.

    If this doesn't work, and if perhaps the new admin account has upload issues as well, then we'll need to look into an issue with the admin role template.

    Let me know if any of this helps!

    Best regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.