WordPress.org

Support

Support » Plugins and Hacks » Download Monitor » [Plugin: WordPress Download Monitor] Remove extra bits from Add Upload page

[Plugin: WordPress Download Monitor] Remove extra bits from Add Upload page

  • This plugin is exactly what I needed!

    One caveat–the “Add New Download” screen was wayyyy too complicated for my clients to use. The fix? Remove the extra bits with a bit of jQuery. Add the following to your theme’s functions.php:

    /**
     * Remove extra confusing bits from "Add Download" screen
     */
    add_action('downloads_page_dlm_addnew', 'remove_add_download_cruft');
    function remove_add_download_cruft() {
    	if(!current_user_can('manage_options')) { ?>
    		<script type="text/javascript">
    			jQuery.noConflict();
    			(function($) {
    				$(function() {
    					$('input#dlversion, input#dlhits, textarea[name=mirrors], input[name=thumbnail_upload], input[name=memberonly], input[name=forcedownload]').parents('tr').hide();
    
    					$('table.optiontable + h3').hide();
    					$('code').parents('p').hide();
    					$('tbody#customfield_list').parents('table').hide();
    				});
    			})(jQuery);
    
    		</script>
    	<?php }
    }

    This will remove everything but the basic options, which is exactly what my clients needed. Note: this will remove those options only for non-admins. If you want to remove it for admins also, remove the if(!current_user_can('manage_options')) line and it’s accompanying braces.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Corbula

    @corbula

    Thanks, this works but it only works for the add new download page. How can i do this for the edit download page as well?

    eriktdesign

    @eriktdesign

    Hmm… That’s a good question. If you can figure out the admin “slug” for that page, you can add another action calling the same function:

    `add_action(‘downloads_page_dlm_edit’, ‘remove_add_download_cruft’);

    Corbula

    @corbula

    I’m pretty sure the slug is:
    dlm_config

    looking at the download_monitor.php file.

    How do you add a second action?

    I’ve tried putting a second line underneath the add_action that says:
    add_action(‘downloads_page_dlm_config’, ‘remove_add_download_cruft’);

    But that’s not worked.

    eriktdesign

    @eriktdesign

    That would be the correct way to do it–so if it’s not working, then the slug is probably wrong.

    Corbula

    @corbula

    wp_dlm_admin is definitely the slug but it’s not working.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: WordPress Download Monitor] Remove extra bits from Add Upload page’ is closed to new replies.
Skip to toolbar