Skip to content

Commit

Permalink
MDL-50332 enrol_self: Setting form url for guests
Browse files Browse the repository at this point in the history
Credit to Andrew Nicols.
  • Loading branch information
David Monllao committed Sep 23, 2015
1 parent 201a26b commit 012d14e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion enrol/self/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,11 @@ public function enrol_page_hook(stdClass $instance) {
$data = new stdClass();
$data->header = $this->get_instance_name($instance);
$data->info = $enrolstatus;
$form = new enrol_self_empty_form(null, $data);

// The can_self_enrol call returns a button to the login page if the user is a
// guest, setting the login url to the form if that is the case.
$url = isguestuser() ? get_login_url() : null;
$form = new enrol_self_empty_form($url, $data);
}

ob_start();
Expand Down

0 comments on commit 012d14e

Please sign in to comment.