From 112ecf68ba729773c9ecb4fef0fc4a14bfd3f73a 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 0b5e701d13a..4ff0a19eca9 100644 --- a/lib/enrollib.php +++ b/lib/enrollib.php @@ -470,7 +470,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 96b421fd91a070ef83467915971f9cae1e6e32b3 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 4ff0a19eca9..5d7f3759fc6 100644 --- a/lib/enrollib.php +++ b/lib/enrollib.php @@ -469,10 +469,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; @@ -486,6 +486,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 {