MDL-50332 enrol_self: Setting form url for guests

Credit to Andrew Nicols.
This commit is contained in:
David Monllao
2015-09-23 11:53:12 +08:00
committed by Andrew Nicols
parent 3bf8439e3a
commit f7666835c7
+5 -1
View File
@@ -249,7 +249,11 @@ class enrol_self_plugin extends enrol_plugin {
$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();