WordPress.org

Ready to get started?Download WordPress

Forums

WP-PostRatings
[resolved] Privacy suggestion (2 posts)

  1. BeautyPirate
    Member
    Posted 2 years ago #

    Hey there, I´ve noticed there is no way not to save the users IP address.
    Please implement a setting to replace the IP with a local one in the database. European internet law can be a bitch you know ;-)

    Thanks!

    http://wordpress.org/extend/plugins/wp-postratings/

  2. BeautyPirate
    Member
    Posted 2 years ago #

    I found the answer. In wp-postratings/wp-postratings.php

    Find:

    ### Function: Get IP Address
    if(!function_exists('get_ipaddress')) {
    	function get_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 esc_attr($ip_address);
    	}
    }

    And replace it with:

    ### Function: Get IP Address
    if(!function_exists('get_ipaddress')) {
    	function get_ipaddress() {
    		if (empty($_SERVER["HTTP_X_FORWARDED_FOR"])) {
    			$ip_address = '127.0.0.1';
    		} else {
    			$ip_address = '127.0.0.1';
    		}
    		if(strpos($ip_address, ',') !== false) {
    			$ip_address = explode(',', $ip_address);
    			$ip_address = $ip_address[0];
    		}
    		return esc_attr($ip_address);
    	}
    }

    Notice your localhost IP might be different, if it does not work, ask your provider what localhost IP they are using. This tweak is not update proof so save it into a text file and re-do it after update.

    Other than that it´s a great plugin.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.