This XenForo 2.1 addon provides Geoblocking capabilities for user registration.
You can set allowed and denied lists for countries based on the IP address a user registers from - and optionally force users from non-approved countries into the moderation queue when registering.
The addon uses the free Maxmind GeoLite2 downloadable IP database to identify the country associated with the IP address of a registering user.
As an example, a typical use-case for this addon might be for an Australian website to allow users from Australia and New Zealand to be approved automatically, while users from, say, Russia, Nigeria and other common sources of spammers are blocked from registering. Users from all other countries can be placed into the moderation queue for manual approved by moderators.
GDPR block
A "Reject EU Registrations" option can be enabled to automatically block registrations from any countries within the European Union, which may help minimise risk for sites which are not serving EU members and do not intend to implement full GDPR support. Note that existing registered users will be unaffected by this setting - it only applies at registration.
This option will be over-ridden by Approved and Denied lists, which can be useful for cases such as the UK, where they are technically still part of the EU until Brexit occurs, so by adding "GB" to the Approved list, you can avoid blocking people from the UK while blocking everyone else in Europe.
Of course, users can always use a proxy server to get around these blocks - but at least you've made a concerted effort to block EU members - which is all you can do.
The message a user will receive when their registration is rejected because of the EU block is "Your registration has been rejected because we do not allow people from the European Union to use our site. Please contact the administrator for further information or assistance."
Installation
1. Install the addon using the standard installation mechanisms. The addon will create a single database table for caching of IP address lookup data.
2. Be sure to add some approved and denied countries to the configuration options - see below.
3. Download the GeoLite2 database using the "Update Maxmind Database" function, which can be found under the Tools menu in the admin area. The database is updated by Maxmind weekly and will be automatically downloaded every week using a cron task.
You must have the Phar extension enabled on your server for database download and extraction to function.
Configuration options :
Database update :
The GeoLite2 database is updated automatically once per week using a cron task to download it from Maxmind's servers. To manually update the database, you can use the update tool in the Admin area :
Lookup test
Perform a database lookup and show the country code for the IP address :
Configuration tester
Test an ISO code against your configuration options to determine what action would be taken for a user from that country. Optionally simulate a user from the EU to test EU block configuration.
See also
Version 1.1.1 : bugfix - was using hard coded URL components rather than class properties.
Télécharger V1.1.1 :
Version 1.1.2 : No new functionality included in this release - just some code cleanup and unit testing. No need to upgrade from v1.1.1
Version 1.2.1 - latest composer dependencies - no changes to addon :
- This update only contains the latest composer dependencies, there has been no change to the addon code. Upgrading is optional.
Télécharger V1.2.1 :
Version 1.2.2 bugfix - assert admin permission :
Version 1.6.0 (2026-10-14)
You can set allowed and denied lists for countries based on the IP address a user registers from - and optionally force users from non-approved countries into the moderation queue when registering.
The addon uses the free Maxmind GeoLite2 downloadable IP database to identify the country associated with the IP address of a registering user.
As an example, a typical use-case for this addon might be for an Australian website to allow users from Australia and New Zealand to be approved automatically, while users from, say, Russia, Nigeria and other common sources of spammers are blocked from registering. Users from all other countries can be placed into the moderation queue for manual approved by moderators.
GDPR block
A "Reject EU Registrations" option can be enabled to automatically block registrations from any countries within the European Union, which may help minimise risk for sites which are not serving EU members and do not intend to implement full GDPR support. Note that existing registered users will be unaffected by this setting - it only applies at registration.
This option will be over-ridden by Approved and Denied lists, which can be useful for cases such as the UK, where they are technically still part of the EU until Brexit occurs, so by adding "GB" to the Approved list, you can avoid blocking people from the UK while blocking everyone else in Europe.
Of course, users can always use a proxy server to get around these blocks - but at least you've made a concerted effort to block EU members - which is all you can do.
The message a user will receive when their registration is rejected because of the EU block is "Your registration has been rejected because we do not allow people from the European Union to use our site. Please contact the administrator for further information or assistance."
Installation
1. Install the addon using the standard installation mechanisms. The addon will create a single database table for caching of IP address lookup data.
2. Be sure to add some approved and denied countries to the configuration options - see below.
3. Download the GeoLite2 database using the "Update Maxmind Database" function, which can be found under the Tools menu in the admin area. The database is updated by Maxmind weekly and will be automatically downloaded every week using a cron task.
You must have the Phar extension enabled on your server for database download and extraction to function.
Configuration options :
Database update :
The GeoLite2 database is updated automatically once per week using a cron task to download it from Maxmind's servers. To manually update the database, you can use the update tool in the Admin area :
Lookup test
Perform a database lookup and show the country code for the IP address :
Configuration tester
Test an ISO code against your configuration options to determine what action would be taken for a user from that country. Optionally simulate a user from the EU to test EU block configuration.
See also
- Geoblock Registration Git repository (Bitbucket)
- List of ISO 3166-2 ISO country codes (Wikipedia)
- Maxmind GeoLite2 free downloadable database
- MaxMind GDPR FAQs
Pour consulter le contenu, vous devez : Se connecter ou S'inscrire.
Version 1.1.1 : bugfix - was using hard coded URL components rather than class properties.
Télécharger V1.1.1 :
Pour consulter le contenu, vous devez : Se connecter ou S'inscrire.
Version 1.1.2 : No new functionality included in this release - just some code cleanup and unit testing. No need to upgrade from v1.1.1
- check that vendor folder exists to prevent breaking forum if we somehow didn't run composer install
- latest vendor dependencies
- use mock mmdb database for unit testing testing
- make subcontainer more testable by allowing paths to be replaced at runtime
- verified compatibility with XF 2.2
- bugfix: don't try to uppercase a null iso_code
- php 8 compatibility fix: don't set a default parameter before non-default subsequent parameters
- slight re-arrange to order of code logic for EU checking - no point checking anything related to EU blocking if we don't have EU blocking enabled
- rename table to xf_geoblock_cache to adhere to resource standards
- addon now requires php 7+
- explicitly check for phar extension on install
- add legacy upgrade from XF 1.5 to Setup
- bugfix: wrong link to database update tool in test tool error message
Pour consulter le contenu, vous devez : Se connecter ou S'inscrire.
Version 1.2.1 - latest composer dependencies - no changes to addon :
- This update only contains the latest composer dependencies, there has been no change to the addon code. Upgrading is optional.
Télécharger V1.2.1 :
Pour consulter le contenu, vous devez : Se connecter ou S'inscrire.
Version 1.2.2 bugfix - assert admin permission :
- Minor bugfix to explicitly enforce admin permissions on admincp tools
- updated icon
- latest composer dependencies
Pour consulter le contenu, vous devez : Se connecter ou S'inscrire.
Version 1.3.0 (2026-09-05)
- bugfix: a failed database download could silently reinstall the previous database - PHP caches
PharDataobjects by path and the download always used the same temporary filename, so a second update within one process re-extracted the first archive and reported success - bugfix: the "not configured" message in the admin control panel linked to
#geoblockDatabaseUrl, an option removed in 1.1.0, so the link landed on the option group rather than the field - run
enqueuePostUpgradeCleanUp()on upgrade under XenForo 2.3 and above - now requires XenForo 2.2+
- now requires PHP 7.2+ - the declaration said 7.0, but
geoip2/geoip2andmaxmind-db/readerhave always needed 7.2 - the shipped dependency tree is now held within that floor -
maxmind/web-service-commonis capped at^0.9.0, since0.11requires PHP 8.1 and arrives transitively throughgeoip2/geoip2 - latest composer dependencies
- development files no longer ship inside the release zip
Pour consulter le contenu, vous devez : Se connecter ou S'inscrire.
1.4.0 (2026-09-27)
- bugfix: EU registration blocking has never worked. The visitor's IP was converted to binary before the country lookup, which takes a dotted-quad string, so every address came back unplaceable and no EU registration was ever rejected. Present in every release since 1.0.0. If you have "Reject EU registrations" enabled, EU registrations will start being rejected after this upgrade - that is the option working for the first time, not a new behaviour
- bugfix: the Checks and Tests tools logged two PHP warnings, one of them a deprecation on PHP 8.1 and above, when submitted with a field missing
- the admin-panel message shown when a MaxMind database update fails is now a phrase, so it can be translated
1.5.0 (2026-10-12)
- new option Automatically update the MaxMind database, on by default. Turn it off to keep the database current by your own means - an external cron task running the new
geoblock:update-databasecommand, or any other mechanism that puts a current database file in place. With it off, no license key is needed and none is reported as missing - bugfix: a country lookup required a license key as well as a database. The key is what downloads the database, so a forum holding one the addon had not downloaded itself registered no spam provider, never reached a lookup, and reported nothing about either. No earlier release could reach that state - the new option is what creates it
- three new command line tools:
geoblock:configshows what this forum is configured to block,geoblock:validatechecks that it can actually do it, andgeoblock:update-database downloads the databasenow. geoblock:validate warns when the database is more than 30 days old, however it is updated - which is what catches an external update that has quietly stopped - every row this addon writes to the server error log now begins with
Geoblock: - the license key is declared as this addon's only secret, so a tool reading the forum's configuration over an API can report the other settings without exposing it
- now requires PHP 7.4+. The declaration said 7.2 and was wrong:
Cli/RendersReport.php, which all three command line tools use, has typed properties, and those arrived in PHP 7.4. On PHP 7.2 or 7.3 that file cannot be parsed, and because XenForo loads every addon's command classes merely to list them, php cmd.php stopped working for the whole forum - every addon's commands and XenForo's own - with nothing written to the server error log. Pages were unaffected. If you are on PHP 7.2 or 7.3, this release will refuse to install, which is the point: 1.5.0 should have refused too geoblock:validatenow accepts--unattended. It does nothing here, because this command sends nothing and so has nothing to skip. It is accepted so that one command line works against every addon that offers avalidate- the Maxmind link on the addon's own admin page pointed at a page that has moved
Pour consulter le contenu, vous devez : Se connecter ou S'inscrire.
Dernière édition:

