Moodle – Removing Country field from New User Registration Page

Moodle
  • Click for Remote Support
  • Email Us
  • Tech Articles
  • Click for Mac Support
  • Click for Remote Support
  • Email Us
  • Tech Articles
  • Click for Mac Support

We needed to customize the New User Registration form on our Moodle installation to remove the Country field. This process below can be used for any of the default fields on the new user signup form.

You’ll need access to the PHP files on your Moodle installation.

The file to edit is /moodle/login/signup_form.php.

Simply comment out the lines that add the Country field.

Below you’ll see the PHP comment “double slash” that I’ve placed in front of both lines of code.

$country = get_string_manager()->get_list_of_countries();
$default_country[''] = get_string('selectacountry');
$country = array_merge($default_country, $country);

// $mform->addElement('select', 'country', get_string('country'), $country);
// $mform->addRule('country', get_string('missingcountry'), 'required', null, 'server');

Post a Comment

Your email address will not be published. Required fields are marked *

*