Changeset 8115 for branches/crazyhorse/wp-admin/menu.php
- Timestamp:
- 06/18/2008 01:55:39 AM (18 years ago)
- File:
-
- 1 edited
-
branches/crazyhorse/wp-admin/menu.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/crazyhorse/wp-admin/menu.php
r7857 r8115 5 5 // The minimum level the user needs to access the item: between 0 and 10 6 6 // The URL of the item's file 7 8 $awaiting_mod = wp_count_comments(); 9 $awaiting_mod = $awaiting_mod->moderated; 10 11 $top_menu = array(); 12 $top_menu[5] = array( __('My Account'), 'read', 'profile.php' ); 13 $top_menu[10] = array( __('My Dashboard'), 'read', 'index.php' ); 14 $top_menu[15] = array( __('New Post'), 'edit_posts', 'post-new.php' ); 15 $top_menu[20] = array( sprintf( __('Comments (%s)'), "<span id='awaiting-mod' class='count-$awaiting_mod'><span class='comment-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php' ); 16 $top_menu[25] = array( __('Help'), 'read', 'index.php?help' ); // place holder 17 18 $top_submenu = array(); 19 $top_submenu['profile.php'][5] = array( __('Something'), 'read', 'profile.php?something' ); // place holder 20 7 21 $menu[0] = array(__('Dashboard'), 'read', 'index.php'); 8 22 … … 21 35 $menu[10] = array(__('Manage'), 'edit_posts', 'edit.php'); 22 36 23 $awaiting_mod = wp_count_comments();24 $awaiting_mod = $awaiting_mod->moderated;25 37 $menu[15] = array(__('Design'), 'switch_themes', 'themes.php'); 26 38 $menu[20] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='count-$awaiting_mod'><span class='comment-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php'); … … 82 94 $_wp_menu_nopriv = array(); 83 95 // Loop over submenus and remove pages for which the user does not have privs. 84 foreach ($submenu as $parent => $sub) { 85 foreach ($sub as $index => $data) { 86 if ( ! current_user_can($data[1]) ) { 87 unset($submenu[$parent][$index]); 88 $_wp_submenu_nopriv[$parent][$data[2]] = true; 96 foreach ( array( 'top_submenu', 'submenu' ) as $sub_loop ) { 97 foreach ($$sub_loop as $parent => $sub) { 98 foreach ($sub as $index => $data) { 99 if ( ! current_user_can($data[1]) ) { 100 unset(${$sub_loop}[$parent][$index]); 101 $_wp_submenu_nopriv[$parent][$data[2]] = true; 102 } 89 103 } 104 105 if ( empty(${$sub_loop}[$parent]) ) 106 unset(${$sub_loop}[$parent]); 90 107 } 91 92 if ( empty($submenu[$parent]) )93 unset($submenu[$parent]);94 108 } 95 109
Note: See TracChangeset
for help on using the changeset viewer.