• Good plugin, but couple of issues I want to report.

    1. Instead of reporting the user’s IP, your plugin is reporting the Hosting server IP for Cloudflare sites. Consider using the following code –

    private function get_user_ip() {
    		foreach ( array( 'HTTP_CF_CONNECTING_IP', 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR' ) as $key ) {
    			if ( array_key_exists( $key, $_SERVER ) === true ) {
    				foreach ( explode( ',', $_SERVER[$key] ) as $ip ) {
    					$ip = trim( $ip );
    					if ( filter_var( $ip, FILTER_VALIDATE_IP ) !== false ) {
    						return esc_attr( $ip );
    					}
    				}
    			}
    		}
    		return false;
    	}

    2. Please consider storing gethostbyaddr($ip) along with the IP. It’s useful.

    3. Please make Rate my Post Analytics table column’s width dynamic in nature. The page is distorted for IPv6 address. Also increase the width for post and time column and decrease width for ID and Rated column..

    • This topic was modified 5 years, 1 month ago by klaus04.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter klaus04

    (@klaus04)

    Also, please avoid loading your plugin JS and CSS on non-post pages (home page, category, tags, etc.)

    Plugin Support Blaz K.

    (@blazk)

    Hi @klaus04,

    Thanks for your useful suggestions. Feel free to make a PR on GitHub with the proposed changes.

    As for the latter, JS and CSS are loaded on every page because rating/results widgets can also be used on non-post pages. CSS and JS files also include code for top rated posts widget, star ratings on archive pages etc. Both files are 35kb, without gzip compression, so they shouldn’t have a big impact.

    Regards,
    Blaz

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘CF IP Issue’ is closed to new replies.