Index: includes/menu.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/menu.inc,v
retrieving revision 1.373
diff -u -p -r1.373 menu.inc
--- includes/menu.inc	8 Jan 2010 07:30:34 -0000	1.373
+++ includes/menu.inc	10 Jan 2010 16:03:19 -0000
@@ -793,7 +793,7 @@ function _menu_link_translate(&$item) {
     }
     // menu_tree_check_access() may set this ahead of time for links to nodes.
     if (!isset($item['access'])) {
-      if (!empty($item['load_functions']) && !_menu_load_objects($item, $map)) {
+      if (empty($item['skip_load_for_links']) && !empty($item['load_functions']) && !_menu_load_objects($item, $map)) {
         // An error occurred loading an object.
         $item['access'] = FALSE;
         return FALSE;
@@ -1001,6 +1001,7 @@ function menu_tree_all_data($menu_name, 
         'title',
         'title_callback',
         'title_arguments',
+        'skip_load_for_links',
         'theme_callback',
         'theme_arguments',
         'type',
@@ -1186,6 +1187,7 @@ function menu_tree_page_data($menu_name,
           'title',
           'title_callback',
           'title_arguments',
+          'skip_load_for_links',
           'theme_callback',
           'theme_arguments',
           'type',
@@ -3181,6 +3183,7 @@ function _menu_router_build($callbacks) 
       'block callback' => '',
       'title arguments' => array(),
       'title callback' => 't',
+      'skip load for links' => 0,
       'theme arguments' => array(),
       'theme callback' => '',
       'description' => '',
@@ -3242,6 +3245,7 @@ function _menu_router_save($menu, $masks
       'description',
       'position',
       'weight',
+      'skip_load_for_links',
       'file',
     ));
 
@@ -3273,6 +3277,7 @@ function _menu_router_save($menu, $masks
       'description' => $item['description'],
       'position' => $item['position'],
       'weight' => $item['weight'],
+      'skip_load_for_links' => $item['skip load for links'],
       'file' => $item['include file'],
     ));
 
Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.436
diff -u -p -r1.436 system.install
--- modules/system/system.install	9 Jan 2010 02:51:09 -0000	1.436
+++ modules/system/system.install	10 Jan 2010 16:03:21 -0000
@@ -987,6 +987,13 @@ function system_schema() {
         'not null' => TRUE,
         'default' => 0,
       ),
+      'skip_load_for_links' => array(
+        'description' => 'Whether the router load function should be called when displaying a link.',
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+        'size' => 'tiny',
+      ),
       'file' => array(
         'description' => 'The file to include for this element, usually the page callback function lives in this file.',
         'type' => 'text',
@@ -2680,6 +2687,20 @@ function system_update_7050() {
 }
 
 /**
+ * Add 'skip_load_for_links' column to {menu_router}.
+ */
+function system_update_7051() {
+  $schema = array(
+    'description' => 'Whether the router load function should be called when displaying a link.',
+    'type' => 'int',
+    'not null' => TRUE,
+    'default' => 0,
+    'size' => 'tiny',
+  );
+  db_add_field('menu_router', 'skip_load_for_links', $schema);
+}
+
+/**
  * @} End of "defgroup updates-6.x-to-7.x"
  * The next series of updates should start at 8000.
  */
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.1099
diff -u -p -r1.1099 user.module
--- modules/user/user.module	7 Jan 2010 04:54:18 -0000	1.1099
+++ modules/user/user.module	10 Jan 2010 16:03:22 -0000
@@ -1338,15 +1338,39 @@ function user_register_access() {
 }
 
 function user_view_access($account) {
-  return $account && $account->uid &&
-    (
-      // Always let users view their own profile.
-      ($GLOBALS['user']->uid == $account->uid) ||
-      // Administrators can view all accounts.
-      user_access('administer users') ||
-      // The user is not blocked and logged in at least once.
-      ($account->access && $account->status && user_access('access user profiles'))
-    );
+  // If $account is FALSE, return early, since there is nothing else to check.
+  if (!$account) {
+    return FALSE;
+  }
+
+  $return = FALSE;
+  // To avoid calling a full user_load() to check access on menu links,
+  // this function accepts either an int or an object. If an int is passed,
+  // most checks can be done with just that.
+  if (is_numeric($account)) {
+    $account = (object) array('uid' => $account);
+  }
+
+  // Never show a link to the anonymous user account.
+  if ($account->uid) {
+    // Always let users view their own profile.
+    if ($GLOBALS['user']->uid == $account->uid) {
+      $return = TRUE;
+    }
+    elseif (user_access('administer users')) {
+      $return = TRUE;
+    }
+    elseif (user_access('access user profiles')) {
+      // At this point, load the complete account object.
+      if (!isset($account->access)) {
+        $account = user_load($account->uid);
+      }
+      if ($account->access && $account->status) {
+        $return = TRUE;
+      }
+    }
+  }
+  return $return;
 }
 
 /**
@@ -1517,6 +1541,7 @@ function user_menu() {
     'page arguments' => array(1),
     'access callback' => 'user_view_access',
     'access arguments' => array(1),
+    'skip load for links' => TRUE,
     'weight' => -10,
     'menu_name' => 'user-menu',
     'file' => 'user.pages.inc',
@@ -1665,6 +1690,14 @@ function user_uid_optional_to_arg($arg) 
  * Menu item title callback - use the user name.
  */
 function user_page_title($account) {
+  if (is_numeric($account)) {
+    if ($GLOBALS['user']->uid == $account) {
+      $account = $GLOBALS['user'];
+    }
+    else {
+      $account = user_load($account);
+    }
+  }
   return format_username($account);
 }
 
