MDL-42138 user: Require custom profile fields when registering as guest

Previously when someone registers after logging in as a guest, required
custom profile fields would not be required.

Thanks to Andreas Diendorfer for providing the patch.
This commit is contained in:
John Okely 2015-02-02 11:54:21 +08:00
parent 88cd577ef3
commit 8ef7eade79

View File

@ -210,7 +210,7 @@ class profile_field_base {
*/
public function edit_field_set_required($mform) {
global $USER;
if ($this->is_required() && ($this->userid == $USER->id)) {
if ($this->is_required() && ($this->userid == $USER->id || isguestuser())) {
$mform->addRule($this->inputname, get_string('required'), 'required', null, 'client');
}
}