Don't show plugin editor when there are no plugins. props solarissmoke, fixes #13117.

git-svn-id: http://svn.automattic.com/wordpress/trunk@14290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
nacin 2010-04-29 05:34:24 +00:00
parent caa6f219dd
commit 4cd8df217b
2 changed files with 8 additions and 3 deletions

View File

@ -168,9 +168,11 @@ if ( is_super_admin() || ( is_multisite() && isset($menu_perms['plugins']) && $m
$submenu['plugins.php'][5] = array( __('Installed'), 'activate_plugins', 'plugins.php' );
/* translators: add new plugin */
$submenu['plugins.php'][10] = array(_x('Add New', 'plugin'), 'install_plugins', 'plugin-install.php');
$submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' );
$plugins = get_plugins();
if( !empty($plugins) )
$submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' );
}
unset($menu_perms, $update_plugins, $update_count);
unset($menu_perms, $update_plugins, $update_count, $plugins);
if ( current_user_can('list_users') )
$menu[70] = array( __('Users'), 'list_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'div' );

View File

@ -10,7 +10,7 @@
require_once('./admin.php');
if ( !current_user_can('edit_plugins') )
wp_die('<p>'.__('You do not have sufficient permissions to edit plugins for this blog.').'</p>');
wp_die( __('You do not have sufficient permissions to edit plugins for this site.') );
$title = __("Edit Plugins");
$parent_file = 'plugins.php';
@ -21,6 +21,9 @@ wp_admin_css( 'theme-editor' );
$plugins = get_plugins();
if( empty($plugins) )
wp_die( __('There are no plugins installed on this site.') );
if ( isset($_REQUEST['file']) )
$plugin = stripslashes($_REQUEST['file']);