From 2ebbb1828bd6bd03ea3671d5f4c5b2ada21b5d1f Mon Sep 17 00:00:00 2001
From: Elke Kreim <elke.kreim@hs-hannover.de>
Date: Tue, 4 Feb 2025 16:55:05 +0100
Subject: [PATCH] Settings only for courses, except site course

---
 lib.php | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib.php b/lib.php
index 0a0086b..ec419cb 100644
--- a/lib.php
+++ b/lib.php
@@ -27,6 +27,13 @@ define('LOCALHSHEXPORT_NAV_PARTICIPANTS', 'navpart');
 
 
 function local_hshexport_extend_navigation_course($navigation, $course, $context) {
+    global $PAGE, $SITE;
+
+    // Only add this settings item on non-site course pages.
+    if (!$PAGE->course or $PAGE->course->id == $SITE->id) {
+        return;
+    }
+
     if (has_capability('local/hshexport:canexport', $context)) {
         // Create the navigation node.
         $url = new moodle_url('/local/hshexport/export.php', ['id' => $course->id]);
-- 
GitLab