diff -upNr user.old/user.module user.new/user.module
--- user.old/user.module	2007-01-10 10:17:51.000000000 -0500
+++ user.new/user.module	2007-01-12 18:17:21.406226500 -0500
@@ -1,5 +1,5 @@
 <?php
-// $Id: user.module,v 1.742 2007/01/10 15:17:51 dries Exp $
+// $Id$
 
 /**
  * @file
@@ -771,9 +771,11 @@ function user_menu($may_cache) {
 
     // Your personal page
     if ($user->uid) {
-      $items[] = array('path' => 'user/'. $user->uid, 'title' => t('My account'),
-        'callback' => 'user_view', 'callback arguments' => array(arg(1)), 'access' => TRUE,
-        'type' => MENU_DYNAMIC_ITEM);
+  	  if (!module_exists('me')) {
+        $items[] = array('path' => 'user/'. $user->uid, 'title' => t('My account'),
+          'callback' => 'user_view', 'callback arguments' => array(arg(1)), 'access' => TRUE,
+          'type' => MENU_DYNAMIC_ITEM);
+      }
     }
 
     $items[] = array('path' => 'logout', 'title' => t('Log out'),
@@ -1802,7 +1804,9 @@ function user_admin_perm($rid = NULL) {
       $form['permission'][] = array(
         '#value' => $module,
       );
+    if (variable_get('user_sort_access_perms', 1) == 1) {
       asort($permissions);
+    }
       foreach ($permissions as $perm) {
         $options[$perm] = '';
         $form['permission'][$perm] = array('#value' => t($perm));
@@ -2280,13 +2284,13 @@ function user_multiple_delete_confirm_su
 
 function user_admin_settings() {
   // User registration settings.
-  $form['registration'] = array('#type' => 'fieldset', '#title' => t('User registration settings'));
+  $form['registration'] = array('#type' => 'fieldset', '#title' => t('User registration settings'), '#collapsible' => TRUE,);
   $form['registration']['user_register'] = array('#type' => 'radios', '#title' => t('Public registrations'), '#default_value' => variable_get('user_register', 1), '#options' => array(t('Only site administrators can create new user accounts.'), t('Visitors can create accounts and no administrator approval is required.'), t('Visitors can create accounts but administrator approval is required.')));
   $form['registration']['user_email_verification'] = array('#type' => 'checkbox', '#title' => t('Require e-mail verification when a visitor creates an account'), '#default_value' => variable_get('user_email_verification', TRUE), '#description' => t('If this box is checked, new users will be required to validate their e-mail address prior to logging into to the site, and will be assigned a system-generated password. With it unchecked, users will be logged in immediately upon registering, and may select their own passwords during registration.'));
   $form['registration']['user_registration_help'] = array('#type' => 'textarea', '#title' => t('User registration guidelines'), '#default_value' => variable_get('user_registration_help', ''), '#description' => t("This text is displayed at the top of the user registration form. It's useful for helping or instructing your users."));
 
   // User e-mail settings.
-  $form['email'] = array('#type' => 'fieldset', '#title' => t('User e-mail settings'));
+  $form['email'] = array('#type' => 'fieldset', '#title' => t('User e-mail settings'), '#collapsible' => TRUE,'#collapsed' => TRUE,);
   $form['email']['user_mail_welcome_subject'] = array('#type' => 'textfield', '#title' => t('Subject of welcome e-mail'), '#default_value' => _user_mail_text('welcome_subject'), '#maxlength' => 180, '#description' => t('Customize the subject of your welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' !username, !site, !password, !uri, !uri_brief, !mailto, !date, !login_uri, !edit_uri, !login_url.');
   $form['email']['user_mail_welcome_body'] = array('#type' => 'textarea', '#title' => t('Body of welcome e-mail'), '#default_value' => _user_mail_text('welcome_body'), '#rows' => 15, '#description' => t('Customize the body of the welcome e-mail, which is sent to new members upon registering.') .' '. t('Available variables are:') .' !username, !site, !password, !uri, !uri_brief, !mailto, !login_uri, !edit_uri, !login_url.');
   $form['email']['user_mail_admin_subject'] = array('#type' => 'textfield', '#title' => t('Subject of welcome e-mail (user created by administrator)'), '#default_value' => _user_mail_text('admin_subject'), '#maxlength' => 180, '#description' => t('Customize the subject of your welcome e-mail, which is sent to new member accounts created by an administrator.') .' '. t('Available variables are:') .' !username, !site, !password, !uri, !uri_brief, !mailto, !date, !login_uri, !edit_uri, !login_url.');
@@ -2302,7 +2306,7 @@ function user_admin_settings() {
     file_check_directory($picture_path, 1, 'user_picture_path');
   }
 
-  $form['pictures'] = array('#type' => 'fieldset', '#title' => t('Pictures'));
+  $form['pictures'] = array('#type' => 'fieldset', '#title' => t('Pictures'), '#collapsible' => TRUE,);
   $form['pictures']['user_pictures'] = array('#type' => 'radios', '#title' => t('Picture support'), '#default_value' => variable_get('user_pictures', 0), '#options' => array(t('Disabled'), t('Enabled')), '#description' => t('Enable picture support.'));
   $form['pictures']['user_picture_path'] = array('#type' => 'textfield', '#title' => t('Picture image path'), '#default_value' => variable_get('user_picture_path', 'pictures'), '#size' => 30, '#maxlength' => 255, '#description' => t('Subdirectory in the directory %dir where pictures will be stored.', array('%dir' => file_directory_path() .'/')));
   $form['pictures']['user_picture_default'] = array('#type' => 'textfield', '#title' => t('Default picture'), '#default_value' => variable_get('user_picture_default', ''), '#size' => 30, '#maxlength' => 255, '#description' => t('URL of picture to display for users with no custom picture selected. Leave blank for none.'));
@@ -2310,6 +2314,10 @@ function user_admin_settings() {
   $form['pictures']['user_picture_file_size'] = array('#type' => 'textfield', '#title' => t('Picture maximum file size'), '#default_value' => variable_get('user_picture_file_size', '30'), '#size' => 15, '#maxlength' => 10, '#description' => t('Maximum file size for pictures, in kB.'));
   $form['pictures']['user_picture_guidelines'] = array('#type' => 'textarea', '#title' => t('Picture guidelines'), '#default_value' => variable_get('user_picture_guidelines', ''), '#description' => t("This text is displayed at the picture upload form in addition to the default guidelines. It's useful for helping or instructing your users."));
 
+  // Access-control sorting settings
+  $form['access_sorting']= array('#type' => 'fieldset', '#title' => t('Sorting'), '#collapsible' => TRUE,);
+  $form['access_sorting']['user_sort_access_perms'] = array('#type' => 'checkbox','#title' => t('Sort access control permissions'),'#return_value' => 1,'#default_value' => variable_get('user_sort_access_perms', 1),'#description' => t('If checked, permissions for each module will be sorted alphabetically on the ') . l(t('Access control page'),'admin/user/access') . t(' and in the ') . l(t('user selection filters'), 'admin/user/user') . ".",);
+  
   return system_settings_form($form);
 }
 
@@ -2471,7 +2479,9 @@ function user_filters() {
   $t_module = t('module');
   foreach (module_list() as $module) {
     if ($permissions = module_invoke($module, 'perm')) {
-      asort($permissions);
+      if (variable_get('user_sort_access_perms', 1) == 1) {
+        asort($permissions);
+      }
       foreach ($permissions as $permission) {
         $options["$module $t_module"][$permission] = t($permission);
       }
