• Is there a way to set the source of the mmdb file? Would like to download it from another site and use a custom database file as an ideal end state. Have tried initially hosting the raw.githubusercontent.com on another server I use, but when I go to update the settings, it doesnt update anything but doesnt show any errors. Any help would be appreciated!

Viewing 1 replies (of 1 total)
  • Thread Starter dules

    (@dules)

    I found the solution myself: in case anyone is looking to the same, I found that redeclaring the library public static variable in wp-config.php seemed to do the trick. like so `WP_STATISTICS\GeoIP::$library = array(
    ‘country’ => array(
    ‘source’ => ‘Yoursourceaddressgoeshere’,
    ‘file’ => ‘GeoLite2-Country’,
    ‘opt’ => ‘geoip’,
    ‘cache’ => 31536000 //1 Year
    ),
    ‘city’ => array(
    ‘source’ => ‘Yoursourceaddressgoeshere’,
    ‘file’ => ‘GeoLite2-City’,
    ‘opt’ => ‘geoip_city’,
    ‘cache’ => 6998000 //3 Month
    )
    );
    Likewise if you want to track private ip’s (i.e. you’re doing the tracking in a private network: add this again to wp-config and have the array of private subnets to be whatever you want it to be so that your IPs aren’t included e.g. 11.0.0.0/8 or whatever.
    WP_STATISTICS\IP::$private_SubNets = array(‘whatyouwantittobe’); //just set to random ip not in private range/localhost`

    You then also need to modify wp-content/plugins/wp-statistics/includes/class-wp-statistics-ip.php isIP to make it: public static function isIP($ip)
    {
    return filter_var($ip, FILTER_VALIDATE_IP);
    }
    and then in settings/visitorip page, I set it to use Use HTTP_X_REAL_IP or Use HTTP_X_FORWARDED_FOR which seemed to do the trick. Am aware this is probably a really specific use case, but might be useful to someone to know! (would be great to have a more native way to define the source address and disable private IP filters checking built into the plugin though!)

    • This reply was modified 2 years, 11 months ago by dules.
Viewing 1 replies (of 1 total)
  • The topic ‘Set mmdb source’ is closed to new replies.