-

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

Location: Difference between revisions

From MoodleDocs
No edit summary
 
(14 intermediate revisions by 10 users not shown)
Line 14: Line 14:
====Force timezone====
====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."
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====
* You can detect the timezone of the user in the browser (see https://stackoverflow.com/questions/6939685/get-client-time-zone-from-browser) using:
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====
====Default country====
Line 23: Line 31:
===IP address lookup===
===IP address lookup===
====GeoIP City data file====
====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.
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/ https://dev.maxmind.com/geoip/geoip2/geolite2/]. You do need to create a free account to download it. Download the GeoLite2 City GZIP file from the "Download files" area once you have been granted access from registering with dev.maxmind.com. Extract the GeoLiteCity.mmdb file from that GZIP file and upload it to /moodledata/geoip/GeoLiteCity.mmdb.
Since Moodle 3.2 looking up IPv6 addresses using the [http://dev.maxmind.com/geoip/geoip2/geolite2/ GeoLite2] database from [http://www.maxmind.com/ Maxmind] is supported (more info [https://docs.moodle.org/32/en/Upgrading#IP_address_lookups 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 [https://dev.maxmind.com/geoip/geoip2/geolite2/ 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 API key====
Line 32: Line 46:


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.
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 [http://en.wikipedia.org/wiki/ISO_3166-1 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.


[[es:Localización]]
[[es:Localización]]
[[eu:Kokagunea]]
[[eu:Kokagunea]]
[[de:Lokales]]
[[fr:Localisation]]

Latest revision as of 11:10, 16 April 2021

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. Download the GeoLite2 City GZIP file from the "Download files" area once you have been granted access from registering with dev.maxmind.com. Extract the GeoLiteCity.mmdb file from that GZIP file and upload it to /moodledata/geoip/GeoLiteCity.mmdb.

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.