diff --git a/user/index.php b/user/index.php
index <HASH>..<HASH> 100644
--- a/user/index.php
+++ b/user/index.php
@@ -351,6 +351,8 @@
 
     if (!isset($hiddenfields['lastaccess'])) {
         $table->sortable(true, 'lastaccess', SORT_DESC);
+    } else {
+        $table->sortable(true, 'firstname', SORT_ASC);
     }
 
     $table->no_sorting('roles');
MDL-<I> Course Making user lists sortable when lastacess field is hidden