Note: You are currently viewing documentation for Moodle 3.9. Up-to-date documentation for the latest stable version of Moodle may be available here: Location.

Location

From MoodleDocs

Location settings

An administrator can change the following location settings in Administration > Site administration > Location > Location settings.

Time zone settings

The time zone is used to help convert the raw timestamps in the database to human readable dates and times, for the user who is requesting the page.

Default time zone

Use this to set the default time zone for your site. This should be the time zone that most users use, or if that is difficult, where you When available, choose the Area/Location that is proper for you rather than use the UTC settings. These names are standardized by the IANA.

Note: As of Moodle 2.9, the older setting and button to allow you to update time zone codes from Moodle.org has been replaced with standard PHP date and time code. If your PHP version is over 6 months old, time zone data should be updated using the PECL timezonedb package.

Force timezone

If a particular time zone is forced, users will see the name of the time zone on their edit profile page and will be not be able to change it. If you wish to allow individual users to choose their own time zone, leave this at the default "Users can choose their own time zone."

Show a warning when the user might have a different timezone

const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
console.log(tz)
  • Compare the result with the users setting and throw a warning that the user is in a different timezone and times could be wrong.

Default country

Select the country to appear by default on a new user account page form.

Default city

Enter a default city for new user profiles. This may be left blank.

IP address lookup

GeoIP City data file

Location of GeoIP City binary data file. This is a non-invasive way to determine geographical and other information about Internet visitors in real-time. This file is not part of Moodle distribution and must be obtained separately from MaxMind.


There is a GeoIPLite version for free at https://dev.maxmind.com/geoip/geoip2/geolite2/. You do need to create a free account to download it. Extract the GeoLiteCity.dat file and upload it to /moodledata/geoip/GeoLiteCity.dat.

Since Moodle 3.2 looking up IPv6 addresses using the GeoLite2 database from Maxmind is supported (more info here). This replaces the existing GeoLite legacy database used in previous versions and the new GeoIP2 database will need to be installed to use this functionality. See maxmind.com page for how to obtain the database.

You can check to see if the GeoIP data file is available to Moodle by going to: Administration > Site administration > Location > Location settings, under IP Address Lookup.

Google Maps API key

Google Maps for IP address lookup visualization key. The Google Maps API lets you embed Google Maps with JavaScript. This is free.

NOTE: There is no longer support for Google maps API V2 as it has been deprecated since 2010. V3 is now used. See here for details: https://developers.google.com/maps/documentation/javascript/tutorial#api_key

After updating the information in this section, IPs that are displayed as a link, such as in reports, when clicked will open new window with a Google Map indicating the location of the IP, if found and if not a private address.

All country codes

This is the list of countries that may be selected in various places, for example in a user's profile. If blank (the default) the list in countries.php in the standard English language pack is used. Otherwise, you can specify a comma-separated list of codes, for example 'GB,FR,ES' in ISO-3166-1 format.

The list of countries is based on the ISO 3166 list of official country short names, but is not exactly the same. See the comment in MDL-56181 for more details.