﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,severity,resolution,keywords,cc
9876,sort items in the admin menu,Denis-de-Bernardy,ryan,"it's desirable to keep the wp items to the top of the list. but the items added by plugins could arguably be sorted automatically using strnatcasecmp applied to the menu item's title.

this is what I used until 2.7.1:

{{{
function sort_admin_menu()
{
	global $submenu;
	
	#dump($submenu);
	
	foreach ( $submenu as $key => $menu_items )
	{
		switch ( $key )
		{
		case 'edit.php':
		case 'upload.php';
		case 'link-manager.php';
		case 'edit-pages.php';
			$stop = 2;
			break;

		case 'themes.php':
			$stop = 2;
			unset($menu_items[10]); # theme and plugin editors
			unset($menu_items[15]); # add new theme
			break;

		case 'plugins.php':
			$stop = 2;
			unset($menu_items[15]); # theme and plugin editors
			break;
		
		case 'index.php':
		case 'edit-comments.php':
		case 'users.php':
		case 'profile.php':
		case 'tools.php':
		case 'options-general.php':
			$stop = 1;
			break;
		
		default:
			# don't reorder menus added by plugins
			$stop = sizeof($submenu[$key]);
			break;
		}
		
		$unsortable = array();
		$sortable = $menu_items;
		reset($sortable);

		while ( $stop != 0 )
		{
			$mkey = key($sortable);
			$unsortable[$mkey] = current($sortable);
			unset($sortable[$mkey]);

			$stop--;
		}

		uasort($sortable, array('sem_fixes_admin', 'menu_nat_sort'));

		$submenu[$key] = array_merge($unsortable, $sortable);
		
		if ( count($submenu[$key]) == 1 )
		{
			unset($submenu[$key]);
		}
	}
} # sort_admin_menu()


#
# menu_nat_sort()
#

function menu_nat_sort($a, $b)
{
	return strnatcmp($a[0], $b[0]);
} # menu_nat_sort()
}}}

if there is any interest, I'll change the above as needed cook up a patch.",enhancement,closed,normal,,Menus,2.8,minor,wontfix,has-patch tested commit early,
