Title: Set mmdb source
Last modified: April 16, 2022

---

# Set mmdb source

 *  [dules](https://wordpress.org/support/users/dules/)
 * (@dules)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/set-mmdb-source/)
 * 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](https://wordpress.org/support/users/dules/)
 * (@dules)
 * [4 years, 1 month ago](https://wordpress.org/support/topic/set-mmdb-source/#post-15578502)
 * 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 4 years, 1 month ago by [dules](https://wordpress.org/support/users/dules/).

Viewing 1 replies (of 1 total)

The topic ‘Set mmdb source’ is closed to new replies.

 * ![](https://ps.w.org/wp-statistics/assets/icon.svg?rev=3081064)
 * [WP Statistics – Simple, privacy-friendly Google Analytics alternative](https://wordpress.org/plugins/wp-statistics/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-statistics/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-statistics/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-statistics/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-statistics/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-statistics/reviews/)

## Tags

 * [debugging](https://wordpress.org/support/topic-tag/debugging/)

 * 1 reply
 * 1 participant
 * Last reply from: [dules](https://wordpress.org/support/users/dules/)
 * Last activity: [4 years, 1 month ago](https://wordpress.org/support/topic/set-mmdb-source/#post-15578502)
 * Status: not resolved