Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

MDL-30809 do not add guest info to add course form if default instanc…

…e prevented
  • Loading branch information...
commit f7ae52f9dafa2ee42e84dca7a2b42f4e90d2cef0 1 parent b1a17fa
Petr Skoda skodak authored samhemelryk committed

Showing 1 changed file with 10 additions and 2 deletions. Show diff stats Hide diff stats

  1. +10 2 enrol/guest/lib.php
12 enrol/guest/lib.php
@@ -163,8 +163,12 @@ public function enrol_page_hook(stdClass $instance) {
163 163 public function course_edit_form($instance, MoodleQuickForm $mform, $data, $context) {
164 164
165 165 $i = isset($instance->id) ? $instance->id : 0;
166   - $plugin = enrol_get_plugin('guest');
167   - $header = $plugin->get_instance_name($instance);
  166 +
  167 + if (!$i and !$this->get_config('defaultenrol')) {
  168 + return;
  169 + }
  170 +
  171 + $header = $this->get_instance_name($instance);
168 172 $config = has_capability('enrol/guest:config', $context);
169 173
170 174 $mform->addElement('header', 'enrol_guest_header_'.$i, $header);
@@ -215,6 +219,10 @@ public function course_edit_validation($instance, array $data, $context) {
215 219
216 220 $i = isset($instance->id) ? $instance->id : 0;
217 221
  222 + if (!isset($data['enrol_guest_status_'.$i])) {
  223 + return $errors;
  224 + }
  225 +
218 226 $password = empty($data['enrol_guest_password_'.$i]) ? '' : $data['enrol_guest_password_'.$i];
219 227 $checkpassword = false;
220 228

0 comments on commit f7ae52f

Please sign in to comment.
Something went wrong with that request. Please try again.