]> git.mjollnir.org Git - moodle.git/commitdiff
fixed obsoleted use of course->category to find site course - now used SITEID instead...
authorskodak <skodak>
Sun, 12 Nov 2006 08:55:13 +0000 (08:55 +0000)
committerskodak <skodak>
Sun, 12 Nov 2006 08:55:13 +0000 (08:55 +0000)
36 files changed:
calendar/preferences.php
course/lib.php
course/report/log/lib.php
course/user.php
lib/accesslib.php
lib/weblib.php
mod/assignment/lib.php
mod/forum/discuss.php
mod/forum/index.php
mod/forum/markposts.php
mod/forum/settracking.php
mod/forum/subscribe.php
mod/forum/user.php
mod/glossary/export.php
mod/glossary/showentry.php
mod/glossary/view.php
mod/hotpot/index.php
mod/hotpot/report.php
mod/hotpot/review.php
mod/hotpot/view.php
mod/lams/index.php
mod/lams/view.php
mod/lesson/index.php
mod/lesson/locallib.php
mod/resource/index.php
mod/resource/lib.php
mod/resource/type/ims/deploy.php
mod/scorm/player.php
mod/scorm/report.php
mod/scorm/view.php
mod/survey/report.php
mod/workshop/assessments.php
user/edit.php
user/extendenrol.php
user/index.php
user/view.php

index b393fab51921082b86b70a46954cb09c7ffa9299..e168acf839353214ff1fd30b7c6467744ced7994 100644 (file)
@@ -10,7 +10,7 @@
         }
     }
 
-    if ($course->category) {
+    if ($course->id != SITEID) {
         require_login($course->id);
     }
 
@@ -56,7 +56,7 @@
     $strcalendar = get_string('calendar', 'calendar');
     $strpreferences = get_string('preferences', 'calendar');
 
-    if ($course->category) {
+    if ($course->id != SITEID) {
         $navigation = "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
                        <a href=\"view.php\">$strcalendar</a> -> $strpreferences";
     } else {
index b0cb1f681d0b4cf2cccd03691933368a784d384a..d3c35d9cd47bb09ba3ee56de9b084fa8b589311c 100644 (file)
@@ -1513,7 +1513,7 @@ function print_courses($category, $width="100%", $hidesitecourse = false) {
 
     if ($courses) {
         foreach ($courses as $course) {
-            if ($hidesitecourse && !$course->category) {
+            if ($hidesitecourse and ($course->id == SITEID)) {
                 continue;
             }
             print_course($course, $width);
@@ -1598,7 +1598,7 @@ function print_my_moodle() {
 
     if ($courses = get_my_courses($USER->id)) {
         foreach ($courses as $course) {
-            if (!$course->category) {
+            if ($course->id == SITEID) {
                 continue;
             }
             print_course($course, "100%");
index df7f124283c54ad67856cc473675400ff55909b9..ce88756af04a070b223f24373d8633f40438bd93 100644 (file)
@@ -31,7 +31,7 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
     // Get all the possible users
     $users = array();
 
-    if ($course->category) {
+    if ($course->id != SITEID) {
         if ($selectedgroup) {   // If using a group, only get users in that group.
             $courseusers = get_group_users($selectedgroup, 'u.lastname ASC', '', 'u.id, u.firstname, u.lastname, u.idnumber');
         } else {
@@ -103,7 +103,7 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
         }
     }
 
-    if (has_capability('moodle/site:viewreports', $sitecontext) && !$course->category) {
+    if (has_capability('moodle/site:viewreports', $sitecontext) && ($course->id == SITEID)) {
         $activities["site_errors"] = get_string("siteerrors");
         if ($modid === "site_errors") {
             $selectedactivity = "site_errors";
@@ -162,7 +162,7 @@ function print_log_selector_form($course, $selecteduser=0, $selecteddate='today'
     } else {
         //        echo '<input type="hidden" name="id" value="'.$course->id.'" />';
         $courses = array();
-        $courses[$course->id] = $course->fullname . ((empty($course->category)) ? ' (Site) ' : '');
+        $courses[$course->id] = $course->fullname . (($course->id == SITEID) ? ' (Site) ' : '');
         choose_from_menu($courses,"id",$course->id,false);
         if (has_capability('moodle/site:viewreports', $sitecontext)) {
             $a->url = "$CFG->wwwroot/course/report/log/index.php?chooselog=0&group=$selectedgroup&user=$selecteduser"
index 5ad148a3f0b97edae52d8ff4ae6767387aa20b6c..8023768be51ff1178a6f329addda25d2ab6b8724 100644 (file)
@@ -42,7 +42,7 @@
     $strmode           = get_string($mode);
     $fullname          = fullname($user, true);
 
-    if ($course->category) {
+    if ($course->id != SITEID) {
         print_header("$course->shortname: $stractivityreport ($mode)", "$course->fullname",
                  "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> ->
                   <a href=\"../user/index.php?id=$course->id\">$strparticipants</a> ->
index 43ec20b51f313e74627a05126898c523a80fc943..9efcbad8bdedb534b702103e41f9923ce496cdff 100755 (executable)
@@ -2527,7 +2527,7 @@ function get_parent_contexts($context) {
             if (!$course = get_record('course','id',$context->instanceid)) {
                 return array();
             }
-            if (!empty($course->category)) {
+            if ($course->id != SITEID) {
                 $parent = get_context_instance(CONTEXT_COURSECAT, $course->category);
                 return array_merge(array($parent->id), get_parent_contexts($parent));
             } else {
index 7a78e18712d9175a0e0bebeabd42f11ceeb684e8..500494cf90e9f98fae785553e2feb33f9798142a 100644 (file)
@@ -3118,7 +3118,7 @@ function print_user($user, $course, $messageselect=false, $return=false) {
     if (!empty($user->role) and ($user->role <> $course->teacher)) {
         $output .= $string->role .': '. $user->role .'<br />';
     }
-    if ($user->maildisplay == 1 or ($user->maildisplay == 2 and $course->category and !isguest()) or
+    if ($user->maildisplay == 1 or ($user->maildisplay == 2 and ($course->id != SITEID) and !isguest()) or
 has_capability('moodle/course:viewhiddenuserfields', $context)) {
         $output .= $string->email .': <a href="mailto:'. $user->email .'">'. $user->email .'</a><br />';
     }
index 850e644911a9f1cf9949ed1f177e897ab79e348e..f3d04e6102de44a5fd84042b0f38690c13959423 100644 (file)
@@ -77,7 +77,7 @@ class assignment_base {
             $this->strsubmissions = get_string('submissions', 'assignment');
             $this->strlastmodified = get_string('lastmodified');
 
-            if ($this->course->category) {
+            if ($this->course->id != SITEID) {
                 $this->navigation = "<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/course/view.php?id={$this->course->id}\">{$this->course->shortname}</a> -> ".
                                     "<a target=\"{$CFG->framename}\" href=\"index.php?id={$this->course->id}\">$this->strassignments</a> ->";
             } else {
index 3bc475a1d622f12bc753d3d68fb8b0c89e503269..1d93cda5c8609c4d17ee332017c454fce1b9e72c 100644 (file)
 
     $searchform = forum_search_form($course);
 
-    if ($course->category) {
+    if ($course->id != SITEID) {
         print_header("$course->shortname: ".format_string($discussion->name), "$course->fullname",
                      "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
                       $navmiddle $navtail", "", "", true, $searchform, navmenu($course, $cm));
index 8362796795b6defc6df3f8ecaffd12bec37e297f..1fb026810099c63dd86aef4c6c668c69f48386ae 100644 (file)
                     }
                     break;
                 default:
-                    if (!$course->category or empty($forum->section)) {   // Site level or section 0
+                    if (($course->id == SITEID) or empty($forum->section)) {   // Site level or section 0
                         $generalforums[] = $forum;
                         if (isset($forum->keyreference)) {
                             unset($learningforums[$forum->keyreference]);
 
     /// Now let's process the learning forums
 
-    if ($course->category) {    // Only real courses have learning forums
+    if ($course->id != SITEID) {    // Only real courses have learning forums
         // Add extra field for section number, at the front
         array_unshift($learningtable->head, "");
         array_unshift($learningtable->align, "center");
 
     /// Output the page
 
-    if ($course->category) {
+    if ($course->id != SITEID) {
         print_header("$course->shortname: $strforums", "$course->fullname",
                     "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> $strforums",
                     "", "", true, $searchform, navmenu($course));
index 45cb80f3353e4393c121850c9ab7afeea5cbef8b..7537506971593e5b6de06a993cfea97fe31af11c 100644 (file)
@@ -33,7 +33,7 @@
         }
 
         $strforums = get_string('modulenameplural', 'forum');
-        if ($course->category) {
+        if ($course->id != SITEID) {
             print_header($course->shortname, $course->fullname,
                  "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
                   <a href=\"../forum/index.php?id=$course->id\">$strforums</a> -> 
index 111452b0da2f3b2dee3130f99c0c99c16132adff..20754c3a9826153141ee864a3c52e3f73ebf3b24 100644 (file)
@@ -31,7 +31,7 @@
         }
 
         $strforums = get_string('modulenameplural', 'forum');
-        if ($course->category) {
+        if ($course->id != SITEID) {
             print_header($course->shortname, $course->fullname,
                  "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
                   <a href=\"../forum/index.php?id=$course->id\">$strforums</a> -> 
index 7768f31ea4250d963d967baf6e4ad7aa65b45684..0d96a41a1f7e28be5110128da9a6a797a3663e75 100644 (file)
@@ -51,7 +51,7 @@
         }
 
         $strforums = get_string('modulenameplural', 'forum');
-        if ($course->category) {
+        if ($course->id != SITEID) {
             print_header($course->shortname, $course->fullname,
                  "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
                   <a href=\"../forum/index.php?id=$course->id\">$strforums</a> -> 
index 1f6d529b314b801f0a339c782066672ee58540d9..9391a1f983da0a78461c1668a1112bb60317f939 100644 (file)
@@ -36,7 +36,7 @@
     $strmode         = get_string($mode, 'forum');
     $fullname        = fullname($user, has_capability('moodle/site:viewfullnames', $syscontext));
 
-    if ($course->category) {
+    if ($course->id != SITEID) {
         print_header("$course->shortname: $fullname: $strmode", "$course->fullname",
                  "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
                   <a href=\"$CFG->wwwroot/user/index.php?id=$course->id\">$strparticipants</a> ->
index ce3528f0d1110496cd77e7c1639a2bf335711cf9..4497f5d154043138d74612ffe3cca15f299178be 100644 (file)
@@ -38,7 +38,7 @@
     $strexportfile = get_string("exportfile", "glossary");
 
     $navigation = "";
-    if ($course->category) {
+    if ($course->id != SITEID) {
         $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
         require_login($course->id);
     }
index ced02327f3f3dddd2a3388b80368e7f55b3d7eb2..febbd5b57927bbb21af8efed55656d13a6ab77f4 100644 (file)
@@ -40,7 +40,7 @@
 
     if (!empty($courseid)) {
         $course = get_record("course", "id", $courseid);
-        if ($course->category) {
+        if ($course->id != SITEID) {
             require_login($courseid);
         }
 
@@ -48,7 +48,7 @@
         $strsearch = get_string("search");
 
         $CFG->framename = "newwindow";
-        if ($course->category) {
+        if ($course->id != SITEID) {
             print_header(strip_tags("$course->shortname: $strglossaries $strsearch"), "$course->fullname",
             "<a target=\"newwindow\" href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> -> $strglossaries -> $strsearch", "", "", true, "&nbsp;", "&nbsp;");
         } else {
index 5e5b49c66d681cb0c994c399b8806dc50e4422b6..496855a4c04fb88e95ec7bf999ac2a3f1aab1e84 100644 (file)
     }
 /// Processing standard security processes
     $navigation = "";
-    if ($course->category) {
+    if ($course->id != SITEID) {
         $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
         require_login($course->id);
     }
index 14acf5571deeab6a92df90d60675d019b7ad0643..3ff0c2d0197ff3a5d831521cfb4f80b479bb06f1 100644 (file)
@@ -37,7 +37,7 @@
     $title = "$course->shortname: $strmodulenameplural";
     $heading = "$course->fullname";
     $navigation = "$strmodulenameplural";
-    if ($course->category) {
+    if ($course->id != SITEID) {
         $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> $navigation";
     }
     print_header($title, $heading, $navigation, "", "", true, "", navmenu($course));
index c4899b224b6cf63edb2d29065ca5d17b9550f1de..0dfb8deb40b5d818c47fef56a56db9eae0be37c7 100644 (file)
@@ -411,7 +411,7 @@ function hotpot_print_report_heading(&$course, &$cm, &$hotpot, &$mode) {
     } else {
         $navigation .= get_string("report", "quiz");
     }
-    if ($course->category) {
+    if ($course->id != SITEID) {
         $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> $navigation";
     }
     $button = update_module_button($cm->id, $course->id, $strmodulename);
index ad0172a665327094d476c20c688b0a136ba720c8..7e114feac7631e850ac5c19320fd2b98fc3ea8a6 100644 (file)
@@ -53,7 +53,7 @@
     $title = "$course->shortname: $hotpot->name";
     $heading = "$course->fullname";
     $navigation = "<a href=\"index.php?id=$course->id\">$strmodulenameplural</a> -> ".get_string("review", "quiz");
-    if ($course->category) {
+    if ($course->id != SITEID) {
         $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> $navigation";
     }
     $button = update_module_button($cm->id, $course->id, $strmodulename);
index b65ce8dd49179c95da9b1c927be3f274c8285038..713b8d3b1d4c17d00c93fb92ef43a8a5165cf133 100644 (file)
@@ -44,7 +44,7 @@
     $heading = "$course->fullname";
     $target = empty($CFG->framename) ? '' : ' target="'.$CFG->framename.'"'; 
     $navigation = '<a'.$target.' href="'.$CFG->wwwroot.'/mod/hotpot/index.php?id='.$course->id.'">'.get_string("modulenameplural", "hotpot")."</a> -> $hotpot->name";
-    if ($course->category) {
+    if ($course->id != SITEID) {
         $navigation = '<a'.$target.' href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$course->shortname.'</a> -> '.$navigation;
     }
     $button = update_module_button($cm->id, $course->id, get_string("modulename", "hotpot").'" style="font-size:0.75em;');
index 6dcb593520aec0630913b1303c5c848701301715..62399df417501c29e710b70d046161e629993412 100644 (file)
@@ -24,7 +24,7 @@
 
 /// Print the header
 
-    if ($course->category) {
+    if ($course->id != SITEID) {
         $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
     }
 
index a078017ace74d691f5a351d55fde73b10d7354a6..6e7c8cf3d4965497850f93da52beb4b6e4e7080b 100644 (file)
@@ -28,7 +28,7 @@ add_to_log($course->id, "lams", "view", "view.php?id=$cm->id", "$lams->id");
 
 /// Print the page header
 
-//if ($course->category) {
+//if ($course->id != SITEID) {
 //    $navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
 //}
 print_header_simple(format_string($lams->name), "",
index 70d8c378a7461d64c992430069e4d756a5217a9f..497ad70696ce7c8a23b96230e6619eabbc868b38 100644 (file)
@@ -29,7 +29,7 @@
 
 /// Print the header
 
-    if ($course->category) {
+    if ($course->id != SITEID) {
         $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
     } else {
         $navigation = '';
index af6a83e3e0d157f294f535ab416838c78d55e4d4..92e9e8db0a686e44074ee8fa43ed8dc273f976da 100644 (file)
@@ -272,7 +272,7 @@ function lesson_print_header($cm, $course, $lesson, $currenttab = '') {
     }
     
 /// Header setup
-    if ($course->category) {
+    if ($course->id != SITEID) {
         $navigation = "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\" title=\"$course->fullname\">$course->shortname</a> ->";
     } else {
         $navigation = '';
index 221ce1020ddeea42a4b1ec0df25e37fb03d412a4..daef0b5ac5aeeef01809cdba186ce4e1b967640d 100644 (file)
@@ -12,7 +12,7 @@
         error("Course ID is incorrect");
     }
 
-    if ($course->category) {
+    if ($course->id != SITEID) {
         require_login($course->id);
         $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
     } else {
index 761402298d916239c522b56b1ea759ab65adf1c0..fa2fdd36561998cd99a6d3ec3fd6f7d7e77b142f 100644 (file)
@@ -113,7 +113,7 @@ function resource_base($cmid=0) {
         $this->strresource  = get_string("modulename", "resource");
         $this->strresources = get_string("modulenameplural", "resource");
 
-        if ($this->course->category) {
+        if ($this->course->id != SITEID) {
             $this->navigation = "<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/course/view.php?id={$this->course->id}\">{$this->course->shortname}</a> -> ".
                                 "<a target=\"{$CFG->framename}\" href=\"index.php?id={$this->course->id}\">$this->strresources</a> ->";
         } else {
index bca2c9619d8ded73b904c00607675b8859ccf413..24c317a2c85877c95b6835720c19ab4e5b48698c 100644 (file)
@@ -54,7 +54,7 @@
 
 /// Instantiate a resource_ims object and modify its navigation
     $resource_obj = new resource_ims ($cmid);
-    if ($resource_obj->course->category) {
+    if ($resource_obj->course->id != SITEID) {
         $resource_obj->navigation = "<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/course/view.php?id={$course->id}\">{$course->shortname}</a> -> ".
                             "<a target=\"{$CFG->framename}\" href=\"$CFG->wwwroot/mod/resource/index.php?id={$course->id}\">$resource_obj->strresources</a> -> ";
     } else {
index 7116d533d01469b4e0a7cd853c0750bc3d7e5fb2..6f8b81f02f69c9f13330960c90cd88f7055e01e2 100755 (executable)
@@ -45,7 +45,7 @@
     $strscorm  = get_string('modulename', 'scorm');
     $strpopup = get_string('popup','scorm');
 
-    if ($course->category != 0) {
+    if ($course->id != SITEID) {
         $navigation = "<a target=\"{$CFG->framename}\" href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
         if ($scorms = get_all_instances_in_course('scorm', $course)) {
             // The module SCORM/AICC activity with the first id is the course  
index ed12a39b6ce13ab45b26257dfa6fc3e04836d74b..a9f4c9058c45dfe999690c975e8536272858da0a 100755 (executable)
@@ -57,7 +57,7 @@
 
 /// Print the page header
     if (empty($noheader)) {
-        if ($course->category) {
+        if ($course->id != SITEID) {
             $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
         } else {
             $navigation = '';
index 03908ee18d57588980457e57eb148969a3562fc6..45460c5cee4db5ead2eee0b7dbd3e359466cc6f0 100755 (executable)
@@ -42,7 +42,7 @@
     $strscorms = get_string("modulenameplural", "scorm");
     $strscorm  = get_string("modulename", "scorm");
 
-    if ($course->category != 0) { 
+    if ($course->id != SITEID) { 
         $navigation = "<a target=\"{$CFG->framename}\" href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
         if ($scorms = get_all_instances_in_course('scorm', $course)) {
             // The module SCORM activity with the least id is the course  
index 4e1b968f45b8a6d193e99e85fa5411c91d50610f..e6691a3d10edf23ab2eb351e6e1ef12825b70edb 100644 (file)
@@ -56,7 +56,7 @@
 
     add_to_log($course->id, "survey", "view report", "report.php?id=$cm->id", "$survey->id", $cm->id);
 
-    if ($course->category) {
+    if ($course->id != SITEID) {
         $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
                        <a href=\"index.php?id=$course->id\">$strsurveys</a> ->
                        <a href=\"view.php?id=$cm->id\">".format_string($survey->name,true)."</a> -> ";
index 4d5dc1f568023ee103bffba9607642664d2b67fd..73fc894cfa108423e8d775595f78be8d9643e9f2 100644 (file)
@@ -66,7 +66,7 @@
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
 
     $navigation = "";
-    if ($course->category) {
+    if ($course->id != SITEID) {
         $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
     }
 
index 7f0033ddc0af347466f797ae548f86ebfcb87388..9e126685c6d77c51d649465a0faf78ae12f5386f 100644 (file)
         } else {
             $userfullname = fullname($user, has_capability('moodle/site:viewfullnames', get_context_instance(CONTEXT_COURSE, $course->id)));
         }
-        if ($course->category) {
+        if ($course->id != SITEID) {
             print_header("$course->shortname: $streditmyprofile", "$course->fullname: $streditmyprofile",
                         "<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a>
                         -> <a href=\"index.php?id=$course->id\">$strparticipants</a>
index 56e9d400d431e3eb628f27d3098dc4b806fc2031..5ce00eb5276094175c4140016da1b6b158e1f25b 100644 (file)
@@ -30,7 +30,7 @@ if ((count($users) > 0) and ($form = data_submitted()) and confirm_sesskey()) {
 
 /// Print headers
 
-if ($course->category) {
+if ($course->id != SITEID) {
     print_header("$course->shortname: ".get_string('extendenrol'), $course->fullname,
     "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> -> ".
     get_string('extendenrol'), "", "", true, "&nbsp;", navmenu($course));
index ee860636a9f35f18728f9bd0fac07d1a577f34d9..d4373545bcdb983de3b70cfe525e8a2700756b87 100644 (file)
@@ -60,7 +60,7 @@
         print_error('nopermissions');
     }
 
-    if (!$course->category) {
+    if ($course->id == SITEID) {
         if (!has_capability('moodle/course:viewparticipants', get_context_instance(CONTEXT_SYSTEM, SITEID))) {
             print_header("$course->shortname: ".get_string('participants'), $course->fullname,
                          get_string('participants'), "", "", true, "&nbsp;", navmenu($course));
 
 /// Print headers
 
-    if ($course->category) {
+    if ($course->id != SITEID) {
         print_header("$course->shortname: ".get_string('participants'), $course->fullname,
                      "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> -> ".
                      get_string('participants'), "", "", true, "&nbsp;", navmenu($course));
index 0934815d1ad2262b98f1a5aaba7f8cbf4992be9e..b156472ccf70ed85768861cb8e3fc617e5cf4859 100644 (file)
 
 /// We've established they can see the user's name at least, so what about the rest?
 
-    if ($course->category) {
+    if ($course->id != SITEID) {
         print_header("$strpersonalprofile: $fullname", "$strpersonalprofile: $fullname",
                      "<a href=\"../course/view.php?id=$course->id\">$course->shortname</a> ->
                       <a href=\"index.php?id=$course->id\">$strparticipants</a> -> $fullname",
     }
 
 
-    if ($course->category and ! isguest() ) {   // Need to have access to a course to see that info
+    if (($course->id != SITEID) and ! isguest() ) {   // Need to have access to a course to see that info
         if (!has_capability('moodle/course:view', $coursecontext)) {
             print_heading(get_string('notenrolled', '', $fullname));
             print_footer($course);
     }
 
     if ($user->maildisplay == 1 or
-       ($user->maildisplay == 2 and $course->category and !isguest()) or
+       ($user->maildisplay == 2 and ($course->id != SITEID) and !isguest()) or
        isteacher($course->id)) {
 
         $emailswitch = '';