WordPress.org

Ready to get started?Download WordPress

Forums

Download Monitor
Remove extra bits from Add Upload page (6 posts)

  1. eriktdesign
    Member
    Posted 3 years ago #

    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.

  2. Corbula
    Member
    Posted 2 years ago #

    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?

  3. eriktdesign
    Member
    Posted 2 years ago #

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

  4. Corbula
    Member
    Posted 2 years ago #

    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.

  5. eriktdesign
    Member
    Posted 2 years ago #

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

  6. Corbula
    Member
    Posted 2 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic