WordPress.org

Ready to get started?Download WordPress

Forums

WP Statistics
[resolved] GeoIP - only unknown Countries :/ (9 posts)

  1. VDR-PL
    Member
    Posted 6 months ago #

    Hi, i use 4.6.1 version, set GeoIP Settings to Active, set Populate missing GeoIP after update of GeoIP DB to active and download a databases GeoIP but still have only unknown at Country stats. I try go to Optimization and in GeoIP Options click Update Now, but Ive got only a blank page :/ I use PHP 5.4.23. I try recognize IP at MaxMing homepage and all working ok, why this didnt work at WordPress with WP-Statistic ?

    http://wordpress.org/plugins/wp-statistics/

  2. Greg Ross
    Member
    Plugin Author

    Posted 6 months ago #

    This usually caused by the database not downloading correctly.

    If you can check the fi size, it will be in wordpress/wp-content/plugins/wp-stastics/GeoIp2-db.

    It should be about 1.6meg.

  3. VDR-PL
    Member
    Posted 6 months ago #

    I try it and get manually by wget but without results :/

    Actually I have:
    -rw-rw-rw- 1603543 Dec 10 01:52 GeoLite2-Country.mmdb
    md5 sum:
    MD5 (GeoLite2-Country.mmdb) = 7741311611c8da3568a6a71ef26b7c92

  4. Greg Ross
    Member
    Plugin Author

    Posted 6 months ago #

    That's the right size for the file so it should be working. Do you have access to any PHP error logs that might be able to shed some light on the issue?

  5. VDR-PL
    Member
    Posted 6 months ago #

    Yeap, i see that script try select from statistics_visitor but in MySQL is a wp_statistics_visitor:

    WordPress database error Table 'blabla.statistics_visitor' doesn't exist for query SELECT id,ip FROM statistics_visitor WHERE location = '' or location = '000' or location IS NULL made by do_action('statistics_page_wp-statistics/optimization'), call_user_func_array, wp_statistics_optimization, include_once('/plugins/wp-statistics/includes/optimization/optimization-geoip.php'), wp_statistics_populate_geoip_info,

    PHP Fatal error: Call to undefined function MaxMind\\Db\\Reader\\bcadd() in /usr/home/morskie/www/wp-content/plugins/wp-statistics/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php on line 252,

    In databases blabla SELECT * FROM wp_statistics_visitor:
    Showing rows 0 - 21 (22 total)

  6. VDR-PL
    Member
    Posted 6 months ago #

    I added BC Math extensions to php so bcadd function is actually available ;) but still is problem with {$table_prefix}statistics_visitor I changed manually at geoip-populate.php to wp_statistics_visitor but this generated other errors with table_prefix:

    WordPress database error Table 'morskie.statistics_visitor' doesn't exist for query UPDATE statistics_visitor SET location = 'PL' WHERE id = '1' made by do_action('statistics_page_wp-statistics/optimization'), call_user_func_array, wp_statistics_optimization, include_once('/plugins/wp-statistics/includes/optimization/optimization-geoip.php'), wp_statistics_populate_geoip_info,

    So problem is with {$table_prefix}statistics_visitor

  7. Greg Ross
    Member
    Plugin Author

    Posted 6 months ago #

    edit wp-statistics/includes/functions/geoip-populate.php, change:

    function wp_statistics_populate_geoip_info() {
    	global $wpdb;
    
    	$result = $wpdb->get_results("SELECT id,ip FROM <code>{$table_prefix}statistics_visitor</code> WHERE location = '' or location = '000' or location IS NULL");

    to:

    function wp_statistics_populate_geoip_info() {
    	global $wpdb;
    
    	$table_prefix = $wpdb->prefix;
    
    	$result = $wpdb->get_results("SELECT id,ip FROM <code>{$table_prefix}statistics_visitor</code> WHERE location = '' or location = '000' or location IS NULL");

    See if that works.

  8. VDR-PL
    Member
    Posted 6 months ago #

    After add $table_prefix = $wpdb->prefix;
    all working perfectly :) :) Thanks.

  9. Greg Ross
    Member
    Plugin Author

    Posted 4 months ago #

    Closing topic.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.