#352734 by Damien Tournoud: the "compact mode" switch should work for anonymous users.

From: Damien Tournoud <damien@tournoud.net>


---

 modules/system/system.module |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)


diff --git modules/system/system.module modules/system/system.module
index ab1e6c6..7789e28 100644
--- modules/system/system.module
+++ modules/system/system.module
@@ -1442,7 +1442,12 @@ function confirm_form($form, $question, $path, $description = NULL, $yes = NULL,
  */
 function system_admin_compact_mode() {
   global $user;
-  return (isset($user->admin_compact_mode)) ? $user->admin_compact_mode : variable_get('admin_compact_mode', FALSE);
+  if ($user->uid) {
+    return (isset($user->admin_compact_mode)) ? $user->admin_compact_mode : variable_get('admin_compact_mode', FALSE);
+  }
+  else {
+    return (isset($_SESSION['admin_compact_mode'])) ? $_SESSION['admin_compact_mode'] : variable_get('admin_compact_mode', FALSE);
+  }
 }
 
 /**
@@ -1453,7 +1458,12 @@ function system_admin_compact_mode() {
  */
 function system_admin_compact_page($mode = 'off') {
   global $user;
-  user_save($user, array('admin_compact_mode' => ($mode == 'on')));
+  if ($user->uid) {
+    user_save($user, array('admin_compact_mode' => ($mode == 'on')));
+  }
+  else {
+    $_SESSION['admin_compact_mode'] = ($mode == 'on');
+  }
   drupal_goto(drupal_get_destination());
 }
 
