Country field on Self Register

Re: removing the need to enter Country field on Self Register

by Iñaki Arenaza -
Number of replies: 0
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

You could add it at the top of user/edit_form.php, next to the block of code that starts with the comment 'Add some extra hidden fields'. But then those fields would be added again in user/editlib.php giving you a nice error.

So you can edit user/editlib.php and search for the block of lines that read:

$mform->addElement('text', 'city', get_string('city'), 'maxlength="20" size="21"');
$mform->setType('city', PARAM_MULTILANG);
$mform->addRule('city', $strrequired, 'required', null, 'client');

and simply comment the last line (the addRule line). A few lines below you'll find the code for the country field. Just do the same.

Saludos. Iñaki.