WordPress.org

Ready to get started?Download WordPress

Forums

Allow contributor to upload media (17 posts)

  1. smplejohn
    Member
    Posted 5 years ago #

    Alright, so after all morning of searching how to modify WordPress to allow contributor to upload media I found nothing and decided to open some source files. I'm just posting my results here for the world to see.

    1) Open wp-admin/includes/dashboard.php - comment out 349 and 353
    2) Open wp-admin/media-upload.php - comment out 15-16
    3) Open wp-includes/general-tamplate.php - comment out 1508 and 1512 (on 1508 be sure to leave the closing ?> to end the php statement on 1511.

    That's it (at least, I think that's it). Hope this helps someone out there. Leave a quick post if it does. I'm just curious.

  2. oste15
    Member
    Posted 5 years ago #

    I tried this little tutorial and it did NOT work.

    Thanks for the effort, I couldent find anything on this either.

    I am just trying to get it so authors can upload images and other media. I am surprised this hasent been covered yet.

  3. smplejohn
    Member
    Posted 5 years ago #

    It may not have worked b/c I did this for contributors, not authors. I think authors could already upload... may be wrong though.

  4. holyinsomniac
    Member
    Posted 5 years ago #

    Actually, it is pretty simple. You will be able to accomplish the following:
    1. Hide the Dashboard from the subscribers view. Only thing visible to subscribers will be their profile.
    2. Enable File Upload functionality for Contributers. Your contributors will be able to upload images
    3. Hide the dashboard and tools and media menu for all contributers. Your contributers will be able to upload images but will not be able to view or delete any other images.

    Here we go:
    You need 2 plugins to do this for you. First you need to get the Role Manager plugin and enable "Upload Files" for the contributer level. Then get the WP-Hide Dashboard plugin from http://www.kpdesign.net/wp-plugins/wp-hide-dashboard/, which will hide the dashboard for all subscribers. Most probably you don't want your contributors to see the Dashboard or Tools or the Media menu. Media menu includes the upload functionality but it is quiet easy to hide. You just have to edit the wp-hidedashboard.php file. Here is an excerpt from the author:

    How do I change this to hide the dashboard and tools menu and help options from other roles besides Subscriber?

    To hide these from other roles, you will need to edit the plugin in a plain text editor and make the following changes:

    Subscriber → Contributor:
    Change !current_user_can('edit_posts') to !current_user_can('upload_files')
    Subscriber → Author:
    Change !current_user_can('edit_posts') to !current_user_can('create_users')
    Subscriber → Editor:
    Change !current_user_can('edit_posts') to !current_user_can('manage_options')
    There are 3 instances of this code in the plugin - make sure you change all of them.

    Now, to disable the Media menu which includes the upload options. Search for unset($menu[75]); in wp-hidedashboard.php file and Add unset($menu[10]); after it.

    Save and upload and thats it. Now your subscriber or your contributor

  5. feastoffools
    Member
    Posted 5 years ago #

    Anyone have links to sites doing this? Would love to see it in action.

  6. leeroi
    Member
    Posted 5 years ago #

    hello holyinsomniac great to know i can disable the Media Menu..

    now.. i want the go further..
    what is the number for the comments menu and the latest WP Contact Form 7 ? (i want to exclude them in my wp hide dashbiard plugin)

    until now i have the following numbers:

    unset($menu[0]); Hides Dashboard menu
    unset($menu[4]); Hides arrow separator under Dashboard link in 2.7+
    unset($menu[10]); Hides media
    unset($menu[55]); Hides Tools menu in 2.7 and 2.7.1
    unset($menu[75]); Hides Tools menu in 2.8

    where can i find a list of wordpress admin menu's and their corresponding numbers?

    thanks

  7. jbudisantoso
    Member
    Posted 5 years ago #

    @leeroi: If you open the file on your site wp-admin/menu.php you can take a look at all the menu numbers there. It's not commented much, but taking a look at the code it won't be to hard to figure out what's what.

  8. Kim Parsell
    Volunteer Moderator
    Posted 4 years ago #

    @leeroi: I'm the WP Hide Dashboard plugin author. Read this comment for the plugin on my site - it has the code corrections that need to be made in order to accomplish what you want.

  9. dreamyguy
    Member
    Posted 4 years ago #

    @holyinsomniac

    It would be nice to combine these two plugins (WP Hide Dashboard + Role Manager) but according to the comments in the plugin's page, the Role Manager is buggy for 2.8 and is not being actively maintained by Thomas, the author. So that's not an alternative anymore.

    What's the best alternative to still allow contributors to upload media (even while not allowing them to manage media) - which is the whole idea of this support topic?

    Cheers!

  10. Kim Parsell
    Volunteer Moderator
    Posted 4 years ago #

    @dreamyguy: Justin Tadlock just released this plugin today: Members

    From the description:

    Members is a plugin that extends your control over your blog. It's a user, role, and content management plugin that was created to make WordPress a more powerful CMS.

    You should be able to tweak the contributors' capabilities to allow them to upload media.

  11. ballyhoo
    Member
    Posted 4 years ago #

    Hi kpdesign,
    thanks for this MEMBER plugin tip!
    Making private pages is a piece of cake now!

    I do have 1 question tough: I want to make a detail (not private) page, called 'appelmans', which should be updated by one user only (with specific role).
    So I made the capability ‘edit_appelmans_page’. But it doesn’t work. Only if a select also capability 'edit_other_pages'. But ofcours, this makes all the pages editable.

    Do you have any suggestions..?
    thank you very much,
    diederik

  12. Kim Parsell
    Volunteer Moderator
    Posted 4 years ago #

    @ballyhoo: You would need to contact Justin Tadlock regarding the Members plugin (he is the author) regarding your question.

  13. ballyhoo
    Member
    Posted 4 years ago #

    Merci kpdesign!

    He offers also the possibility to become 'exclusive member' (25$/year), but it looks like this is only about the Hybrid themes. I poped the question if I can find help concerning the Members Plugin too.
    And I am now waiting for his response..

    diederik

  14. Kim Parsell
    Volunteer Moderator
    Posted 4 years ago #

    @ballyhoo: I'm a member of ThemeHybrid forum and yes, there is a section where Justin provides support for his WordPress plugins, including the Members plugin.

  15. ballyhoo
    Member
    Posted 4 years ago #

    When you are interested using the members plugin by Justin Tadlock for a CMS, and want to know more about the possibilities with pages.

    QUESTION:
    'How can you restrict by role, which pages a user can post to?
    I’m creating a site where there will be 4 users, each will have a specific page to edit, and each can only see their specific pages in the backend.

    ANSWER you get as a pying exclisive member (25$) from Justin Tadlock:

    > You can't do that with the Members plugin.

  16. Gravitydk
    Member
    Posted 4 years ago #

    Members is great, thanks for the referral.

  17. soulsizzle
    Member
    Posted 4 years ago #

    The simplest way to do this is by placing the following code in your current theme's functions.php file. I cover it in me detail in an article i wrote a little while back, Allowing WordPress Contributors to Upload Files.

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

Topic Closed

This topic has been closed to new replies.

About this Topic