diff --git a/modules/rating.module b/modules/rating.module
index 7580643782355d3ca6e8d24d0318d9b09b567e8c..166edd12fc97c5a7e14aa52c3788c3f52c9e7159 100644
--- a/modules/rating.module
+++ b/modules/rating.module
@@ -93,16 +93,16 @@ function rating_list($limit) {
 function rating_page() {
   global $user, $theme;
 
-  if (user_access($user, "access user ratings")) {
-    $theme->header();
+  $theme->header();
+
+  if (user_access("access user ratings")) {
     $theme->box(t("Top 100 users"), rating_list(100));
-    $theme->footer();
   }
   else {
-    $theme->header();
     $theme->box(t("Access denied"), message_access());
-    $theme->footer();
   }
+
+  $theme->footer();
 }
 
 function rating_block() {