Permalink
Browse files

Merge branch 'w11_MDL-31595_m22_enrolme' of git://github.com/skodak/m…

…oodle into MOODLE_22_STABLE
  • Loading branch information...
stronk7 committed Mar 12, 2012
2 parents 3e6e265 + 1b75985 commit 33d1075328db591dbdb7141f2fd2e56b8f1382dc
Showing with 5 additions and 2 deletions.
  1. +5 −2 lib/enrollib.php
View
@@ -476,8 +476,10 @@ function enrol_add_course_navigation(navigation_node $coursenode, $course) {
$usersnode->trim_if_empty();
if ($course->id != SITEID) {
- // Unenrol link
- if (is_enrolled($coursecontext)) {
+ if (isguestuser() or !isloggedin()) {
+ // 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;
@@ -491,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 {

0 comments on commit 33d1075

Please sign in to comment.