WordPress.org

Make WordPress Core

Ticket #13117: 13117-v2.patch

File 13117-v2.patch, 1.4 KB (added by solarissmoke, 4 years ago)

Don't display plugin editor link when no plugins installed; wp-die plugin editor when no plugins installed; change "blog" -> "site"

  • menu.php

     
    168168                $submenu['plugins.php'][5]  = array( __('Installed'), 'activate_plugins', 'plugins.php' ); 
    169169                /* translators: add new plugin */ 
    170170                $submenu['plugins.php'][10] = array(_x('Add New', 'plugin'), 'install_plugins', 'plugin-install.php'); 
    171                 $submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' ); 
     171                 
     172                $plugins = get_plugins(); 
     173                if( !empty($plugins) ) 
     174                        $submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' ); 
    172175} 
    173176unset($menu_perms, $update_plugins, $update_count); 
    174177 
  • plugin-editor.php

     
    1010require_once('./admin.php'); 
    1111 
    1212if ( !current_user_can('edit_plugins') ) 
    13         wp_die('<p>'.__('You do not have sufficient permissions to edit plugins for this blog.').'</p>'); 
     13        wp_die( __('You do not have sufficient permissions to edit plugins for this site.') ); 
    1414 
    1515$title = __("Edit Plugins"); 
    1616$parent_file = 'plugins.php'; 
     
    2121 
    2222$plugins = get_plugins(); 
    2323 
     24if( empty($plugins) ) 
     25        wp_die( __('There are no plugins installed on this site.') ); 
     26 
    2427if ( isset($_REQUEST['file']) ) 
    2528        $plugin = stripslashes($_REQUEST['file']); 
    2629