AndyB - Register location - Xenforo 2

AndyB - Register location - Xenforo 2 1.0

  • Thread starter Thread starter xenvn
  • Start date Start date
AndyB - Register location - Xenforo 2.webp


Records location during registration.

Setup:
By default this add-on will use the ipapi.com to get the location from the users IP address. However using the API is not as reliable as using the GeoIp2 library. Here is a link which explains how to install the GeoIp2 library.

Database changes:
This add-on will add a field called 'andy_register_location' to your xf_user table.

AndyB - Register location - Xenforo 2-1.webp




Some add-on use by default the ipapi.com API to get a location from the IP address. While this works fairly well, often the service will return an empty result, this is due to excessive use of the service.

GeoIp2 library to the rescue. This GeoIp2 library allows reading the GeoLite2 database located on your server and you can lookup as many IP addresses as you like. The GeoIp2 library is free and is easy to install.

Installation instructions
  1. Create a directory called misc in your public_html directory.
  2. Log into your server using SSH. Log in as a cPanel user or equivalent (do not log in as root).
  3. Navigate to the /misc directory.
  4. Enter the following command composer require geoip2/geoip2:~2.
  5. Composer will install the GeoIp2 library.
A new directory called vendor contains the files needed to use GeoIp2 library.

Example of the vendor directory.

AndyB Register location Xenforo 2-1.webp


In order to use the GeoIp2 library, you will need to download the GeoLite2-City.mmdb database. First step is to register at the maxmind.com site:
www.maxmind.com

Then go to the downloads page here:
www.maxmind.com

Download the GZIP file.

AndyB Register location Xenforo 2-2.webp



Unpack the GZIP file and upload the GeoLite2-City.mmdb file to your /misc directory on your server. Last step is to update the add-ons options page with the path to the autoload.php and GeoLite2-City.mmdb files.
 

Attachments

Similar threads Most view View more
Back
Top Bottom