Rationalize menu access levels. Submenus should have an access level greater than or equal to its parent. Require level 8 for all file editing pages.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1924 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
rboren 2004-12-08 22:32:49 +00:00
parent fc170bc859
commit fb1e3de410
3 changed files with 16 additions and 21 deletions

View File

@ -639,17 +639,12 @@ function parent_dropdown($default = 0, $parent = 0, $level = 0) {
}
function user_can_access_admin_page() {
global $parent_file;
global $pagenow;
global $menu;
global $submenu;
global $user_level;
if (! isset($parent_file)) {
$parent = $pagenow;
} else {
$parent = $parent_file;
}
$parent = get_admin_page_parent();
foreach ($menu as $menu_array) {
//echo "parent array: " . $menu_array[2];

View File

@ -8,7 +8,7 @@ $menu[0] = array(__('Dashboard'), 0, 'index.php');
$menu[5] = array(__('Write'), 1, 'post.php');
$menu[10] = array(__('Manage'), 1, 'edit.php');
$menu[20] = array(__('Links'), 5, 'link-manager.php');
$menu[25] = array(__('Users'), 3, 'users.php');
$menu[25] = array(__('Users'), 0, 'profile.php');
$menu[30] = array(__('Options'), 6, 'options-general.php');
$menu[35] = array(__('Plugins'), 8, 'plugins.php');
$menu[40] = array(__('Presentation'), 8, 'themes.php');
@ -23,28 +23,28 @@ $submenu['edit.php'][15] = array(__('Categories'), 1, 'categories.php');
$submenu['edit.php'][20] = array(__('Comments'), 1, 'edit-comments.php');
$awaiting_mod = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'");
$submenu['edit.php'][25] = array(sprintf(__("Awaiting Moderation (%s)"), $awaiting_mod), 1, 'moderation.php');
$submenu['edit.php'][30] = array(__('Files'), 5, 'templates.php');
$submenu['edit.php'][30] = array(__('Files'), 8, 'templates.php');
$submenu['link-manager.php'][5] = array(__('Manage Links'), 5, 'link-manager.php');
$submenu['link-manager.php'][10] = array(__('Add Link'), 5, 'link-add.php');
$submenu['link-manager.php'][15] = array(__('Link Categories'), 5, 'link-categories.php');
$submenu['link-manager.php'][20] = array(__('Import Links'), 5, 'link-import.php');
$submenu['users.php'][5] = array(__('Authors & Users'), 5, 'users.php');
$submenu['users.php'][10] = array(__('Your Profile'), 5, 'profile.php');
$submenu['users.php'][5] = array(__('Your Profile'), 0, 'profile.php');
$submenu['users.php'][10] = array(__('Authors & Users'), 5, 'users.php');
$submenu['options-general.php'][5] = array(__('General'), 5, 'options-general.php');
$submenu['options-general.php'][10] = array(__('Writing'), 5, 'options-writing.php');
$submenu['options-general.php'][15] = array(__('Reading'), 5, 'options-reading.php');
$submenu['options-general.php'][20] = array(__('Discussion'), 5, 'options-discussion.php');
$submenu['options-general.php'][25] = array(__('Permalinks'), 5, 'options-permalink.php');
$submenu['options-general.php'][30] = array(__('Miscellaneous'), 5, 'options-misc.php');
$submenu['options-general.php'][5] = array(__('General'), 6, 'options-general.php');
$submenu['options-general.php'][10] = array(__('Writing'), 6, 'options-writing.php');
$submenu['options-general.php'][15] = array(__('Reading'), 6, 'options-reading.php');
$submenu['options-general.php'][20] = array(__('Discussion'), 6, 'options-discussion.php');
$submenu['options-general.php'][25] = array(__('Permalinks'), 6, 'options-permalink.php');
$submenu['options-general.php'][30] = array(__('Miscellaneous'), 6, 'options-misc.php');
$submenu['plugins.php'][5] = array(__('Plugins'), 5, 'plugins.php');
$submenu['plugins.php'][10] = array(__('Plugin Editor'), 5, 'plugin-editor.php');
$submenu['plugins.php'][5] = array(__('Plugins'), 8, 'plugins.php');
$submenu['plugins.php'][10] = array(__('Plugin Editor'), 8, 'plugin-editor.php');
$submenu['themes.php'][5] = array(__('Themes'), 5, 'themes.php');
$submenu['themes.php'][10] = array(__('Theme Editor'), 5, 'theme-editor.php');
$submenu['themes.php'][5] = array(__('Themes'), 8, 'themes.php');
$submenu['themes.php'][10] = array(__('Theme Editor'), 8, 'theme-editor.php');
do_action('admin_menu', '');
ksort($menu); // make it all pretty

View File

@ -83,8 +83,8 @@ $edituser = get_userdata($user_id);
if ($edituser->user_level >= $user_level) die( __('You do not have permission to edit this user.') );
?>
<ul id="adminmenu2">
<li><a href="profile.php"><?php _e('Your Profile') ?></a></li>
<li><a href="users.php" class="current"><?php _e('Authors &amp; Users') ?></a></li>
<li><a href="profile.php"><?php _e('Your Profile') ?></a></li>
</ul>
<?php if ( isset($_GET['updated']) ) : ?>