Support » Plugin: IP Geo Block » Great plugin + suggestion

  • I came here on purpose to leave a good review.
    The plugin is useful and works as expected.

    I have a suggestion though:

    It would be even more useful to manage different Blacklists per target.
    For example:

    Comment post -> tick Block by country -> use blacklist 1
    Login form -> tick Block by country -> use blacklist 2
    and so on…

    This is much needed as I have different levels of blocking, and I don’t want to ban an entire country for some specific target, but still want to block some custom IPs.
    I hope you understand my query and that you can provide an update for this in the future.
    Let me know if something was unclear.
    Regards.

Viewing 1 replies (of 1 total)
  • Plugin Author tokkonopapa

    (@tokkonopapa)

    Hi @atx,

    Thank you for your great review and proposal. Your review motivates me a lot!

    You can customize this plugin as you requested using ip-geo-block-xxxxx filter hook where “xxxxx” is one of “comment”, “xmlrpc”, “login”, “admin” and “public”. For example the following example in “functions.php” in your theme or “drop-in.php” in your Geolocation API library folder (recommended) additionally blocks the specific IP addresses on comment form:

    /**
     * Example 4: Usage of 'ip-geo-block-comment'
     * Use case: Block comment from specific IP addresses in the blacklist
     *
     * @param  string $validate['ip'] ip address
     * @param  string $validate['code'] country code
     * @return array $validate add 'result' as 'passed' or 'blocked' if possible
     */
    function my_blacklist( $validate ) {
        $blacklist = array(
            '123.456.789.',
        );
    
        foreach ( $blacklist as $ip ) {
            if ( strpos( $ip, $validate['ip'] ) === 0 ) {
                $validate['result'] = 'blocked';
                break;
            }
        }
    
        return $validate;
    }
    
    add_filter( 'ip-geo-block-comment', 'my_blacklist' );

    You can also $validate['asn'] for AS Number if you enable “Use Autonomous System Number (ASN)” in “Validation rule settings” section.

    The UI of the old version was rather simple than now, but it becomes a bit complicated as the number of users grows up. So I think the UI should be balanced between the simplicity and user’s convenience. Of course, I’ll take your suggestion into my consideration in the future. But for now, please use filter hooks. You can find many example in “samples.php“.

    If you have any question related to this topic, please feel free to post in the forum. I’ll do my best to support you.

    Anyway, thanks again!

Viewing 1 replies (of 1 total)
  • The topic ‘Great plugin + suggestion’ is closed to new replies.