Quantcast
Channel: WordPress.org Forums » [Wordfence Security - Firewall, Malware Scan, and Login Security] Support
Viewing all articles
Browse latest Browse all 32701

petee on "[Plugin: Wordfence Security] Fatal error: Cannot redeclare geoip_country_code_by_name()"

$
0
0

I had the same problem and did not find any support on Wordfence. Here is my solution that worked for me (but I am not sure if the problem will come back after a future Wordfence update)

In: plugins/wordfence/lib/wfGeoIP.php on line 432

Start on line 432 and replace this:

function geoip_country_code_by_name($gi, $name) {
  $country_id = geoip_country_id_by_name($gi,$name);
  if ($country_id !== false) {
        return $gi->GEOIP_COUNTRY_CODES[$country_id];
  }
  return false;
}
function geoip_country_name_by_name($gi, $name) {
  $country_id = geoip_country_id_by_name($gi,$name);
  if ($country_id !== false) {
        return $gi->GEOIP_COUNTRY_NAMES[$country_id];
  }
  return false;
}

************************With this:********************

if (!function_exists('geoip_country_code_by_name')){
    function geoip_country_code_by_name($gi, $name) {
      $country_id = geoip_country_id_by_name($gi,$name);
      if ($country_id !== false) {
            return $gi->GEOIP_COUNTRY_CODES[$country_id];
      }
      return false;
    }
}

if (!function_exists('geoip_country_name_by_name_v6')){
    function geoip_country_name_by_name_v6($gi, $name) {
      $country_id = geoip_country_id_by_name_v6($gi,$name);
      if ($country_id !== false) {
            return $gi->GEOIP_COUNTRY_NAMES[$country_id];
      }
      return false;
    }
}

if (!function_exists('geoip_country_name_by_name')){
    function geoip_country_name_by_name($gi, $name) {
      $country_id = geoip_country_id_by_name($gi,$name);
      if ($country_id !== false) {
            return $gi->GEOIP_COUNTRY_NAMES[$country_id];
      }
      return false;
    }
}

It solved the problem for me.


Viewing all articles
Browse latest Browse all 32701

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>