From 45962a179c0c26a939578dee2123e480fe873b00 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Sat, 10 Mar 2012 09:40:42 +0100 Subject: [PATCH 1/2] MDL-31595 do not show enrolee link to guest account --- lib/enrollib.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/enrollib.php b/lib/enrollib.php index 62e791ae2e5..4072905eab1 100644 --- a/lib/enrollib.php +++ b/lib/enrollib.php @@ -477,7 +477,9 @@ function enrol_add_course_navigation(navigation_node $coursenode, $course) { if ($course->id != SITEID) { // Unenrol link - if (is_enrolled($coursecontext)) { + if (isguestuser() or !isloggedin()) { + // guest account can not be enrolled + } else if (is_enrolled($coursecontext)) { foreach ($instances as $instance) { if (!isset($plugins[$instance->enrol])) { continue; From 1b75985a391d9acee2aa2554923ed1daf0a14c22 Mon Sep 17 00:00:00 2001 From: Petr Skoda Date: Mon, 12 Mar 2012 16:47:28 +0100 Subject: [PATCH 2/2] MDL-31595 improve enrol link comments --- lib/enrollib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/enrollib.php b/lib/enrollib.php index 4072905eab1..7fd29e68f08 100644 --- a/lib/enrollib.php +++ b/lib/enrollib.php @@ -476,10 +476,10 @@ function enrol_add_course_navigation(navigation_node $coursenode, $course) { $usersnode->trim_if_empty(); if ($course->id != SITEID) { - // Unenrol link if (isguestuser() or !isloggedin()) { - // guest account can not be enrolled + // guest account can not be enrolled - no links for them } else if (is_enrolled($coursecontext)) { + // unenrol link if possible foreach ($instances as $instance) { if (!isset($plugins[$instance->enrol])) { continue; @@ -493,6 +493,7 @@ function enrol_add_course_navigation(navigation_node $coursenode, $course) { } } } else { + // enrol link if possible if (is_viewing($coursecontext)) { // better not show any enrol link, this is intended for managers and inspectors } else {