WP-OnlineCounter Widget Throwing Error in Wordpress 2.5

I use the WP-OnlineCounter plugin and widget created by Jan Grewe. And ever since I’ve upgraded to Wordpress 2.5 when opening the “Design” tab and then navigating to “Widgets” I get the following error:

Fatal error: Cannot redeclare get_user_ipaddress() (previously declared in /var/www/web169/html/wp-content/plugins/wp-onlinecounter.php:94) in /var/www/web169/html/wp-content/plugins/wp-onlinecounter.php on line 93

I found a quick and dirty workaround for that issue:

  1. Open wp-onlinecounter.php in your plugins folder
  2. Find the following line of code
    function get_user_ipaddress() {
  3. Add the following before
    if(!function_exists(get_useripaddress()) {
  4. Close the if-statement right after the closing brackets of get_useripadress()

Should look like this:

if(!function_exists(get_user_ipaddress)) {
function get_user_ipaddress() {
if(empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {
$ip_address = $_SERVER["REMOTE_ADDR"];
}else{
$ip_address = $_SERVER["HTTP_X_FORWARDED_FOR"];
}
if(strpos($ip_address, ',') !== false) {
$ip_address = explode(',', $ip_address);
$ip_address = $ip_address[0];
}
return $ip_address;
}
}

Ähnliche Einträge

Über den Autor