Skip to:
Content
Pages
Categories
Search
Top
Bottom

Show only Ipv4 addresses to moderators

  • @sbask

    Participant

    Is there a way to show to moderators/admins only ipv4 addresses? Now that we moved our bbpress based forum site to cloudflare protection we are getting ipv6 addresses in some posters. We’d like to only get ipv4.

Viewing 14 replies - 1 through 14 (of 14 total)
  • @sbask

    Participant

    Alternatively if I can’t disable ipv6 showing, is there a way to better center the info so it can be read more easily?

    @robin-w

    Moderator

    ok, so we can hide the ip6, but getting the ip4 is harder i think.

    I found this post relating to Cloudfare which tends to indicate that even an ip4 might be just a Cloudflare address, but I only spent 2 minutes reading though !!

    https://wordpress.org/support/topic/real-ip-for-the-customers-cloudflare/

    so to hide an IP6, try this (untested!)

    add_filter ('bbp_get_author_ip', 'rew_hide_v6') ;
    
    function rew_hide_v6 ($author_ip='') {
    if ($strlen($author_ip)>20) $author_ip='' ;
    return $author_ip ;
    }

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets

    Let me know if it works

    @sbask

    Participant

    Tried it out on our testsite and when I click on anything to do with comments it errors out.

    There has been a critical error on this website.

    @robin-w

    Moderator

    apologies, try this

    add_filter ('bbp_get_author_ip', 'rew_hide_v6') ;
    
    function rew_hide_v6 ($author_ip='') {
    if (strlen($author_ip)>20) $author_ip='' ;
    return $author_ip ;
    }

    @sbask

    Participant

    Well that didn’t blow it up, but it removed any reference to an IP address at all.
    What if we try this a different way? Can we format the Ipv6 to not be centered and instead be left justified?

    @sbask

    Participant

    The thing is the moderators want to see the IPv6 to run it through spam sites.

    @robin-w

    Moderator

    ok so your first post said the exact opposite 🙂 ie they didn’t want to see the IP6

    @robin-w

    Moderator

    Did you read the cloudfare link that said they might not be seeing the real IP address, but rather a cloudfare server address? may or not be relevant.

    The classes for that are

    bbp-reply-ip
    bbp-topic-ip

    so should be

    .bbp-reply-ip, .bbp-topic-ip{
      text-align: left !important;
    }

    @sbask

    Participant

    They don’t want to see ipv6, they want to see the IPv4 versions like the site used to present. Now it does a mixture of ipv4 and ipv6 and it’s hard to read the ipv6 as it spreads into the border of the post.

    Sorry if I didn’t make that clear.

    @sbask

    Participant

    Sorry for being dense but how do I use the below to make the IPv6 address left justify?

    .bbp-reply-ip, .bbp-topic-ip{
    text-align: left !important;
    }

    @robin-w

    Moderator

    @sbask

    Participant

    I’m not a wordpress developer, I just inherited and run a site. Can I hire you do to this?

    @robin-w

    Moderator

    contact me via

    Contact me

    @robin-w

    Moderator

    ok, I took another look at this, and this new version should show ip4 but not ip6

    add_filter ('bbp_get_author_ip', 'rew_hide_v6') ;
    
    function rew_hide_v6 ($author_ip='') {
    	if (strlen($author_ip)>55) $author_ip='' ;
    return $author_ip ;
    }
Viewing 14 replies - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.
Skip to toolbar