diff --git a/blocks/admin/block_admin.php b/blocks/admin/block_admin.php index a3dab444e85..accf193651f 100644 --- a/blocks/admin/block_admin.php +++ b/blocks/admin/block_admin.php @@ -143,16 +143,14 @@ class block_admin extends block_list { } /// Authorize hooks - if (has_capability('enrol/authorize:managepayments', $context)) { - if ($course->enrol == 'authorize' || (empty($course->enrol) && $CFG->enrol == 'authorize')) { - require_once($CFG->dirroot.'/enrol/authorize/const.php'); - $paymenturl = ''.get_string('payments').' '; - if ($cnt = count_records('enrol_authorize', 'status', AN_STATUS_AUTH, 'courseid', $course->id)) { - $paymenturl .= ''.get_string('paymentpending', 'moodle', $cnt).''; - } - $this->content->items[] = $paymenturl; - $this->content->icons[] = ''; + if ($course->enrol == 'authorize' || (empty($course->enrol) && $CFG->enrol == 'authorize')) { + require_once($CFG->dirroot.'/enrol/authorize/const.php'); + $paymenturl = ''.get_string('payments').' '; + if ($cnt = count_records('enrol_authorize', 'status', AN_STATUS_AUTH, 'courseid', $course->id)) { + $paymenturl .= ''.get_string('paymentpending', 'moodle', $cnt).''; } + $this->content->items[] = $paymenturl; + $this->content->icons[] = ''; } /// View course grades (or just your own grades, same link) @@ -162,14 +160,16 @@ class block_admin extends block_list { $this->content->icons[]=''; } - /// Person can unenrol themselves from this course - if (has_capability('moodle/role:unassignself', $context, NULL, false) and empty($course->metacourse)) { - $this->content->items[]=''.get_string('unenrolme', '', $course->shortname).''; - $this->content->icons[]=''; + if (empty($course->metacourse)) { + if (has_capability('moodle/legacy:guest', $context, NULL, false)) { // Are a guest now + $this->content->items[]=''.get_string('enrolme', '', $course->shortname).''; + $this->content->icons[]=''; + } else if (has_capability('moodle/role:unassignself', $context, NULL, false)) { // Have some role + $this->content->items[]=''.get_string('unenrolme', '', $course->shortname).''; + $this->content->icons[]=''; + } } - - /// Should the following two be in this block?