Is it possible to hide ip address field from profile page using CSS?

Have a look at the below image

The 2 fields:
Last IP address
Registration IP address

These two fields are available for both the admins as well as moderators, when they view anyones user profile.

Is there any way to hide these using CSS?

I don’t think they have any unique class so I’m guessing there is no easy to hide it using CSS.

Can we adopt any other approach to hide these?
If anyone have any suggestions - please share.

Odd that we have specific classes on some rows but not others.

image

@codinghorror any objection to adding specific classes to each row?

1 Like

I object to adding it to every row “just because”, because I hate speculative work. But if there is a legitimate need for certain rows to have it, then that seems OK.

3 Likes

Maybe you have to do it by overriding templates via theme instead of CSS.

OK, adding classes to just the IP address rows for now.

Edit: Commit submitted

6 Likes

Very good idea @lll. But why this much complex code? It can be like below

.admin-contents.admin-users {
  section.details:first-of-type {
    > div:nth-child(9), > div:nth-child(10) {
      background: red
    }
  }
}
4 Likes

:grin::ok_hand: definitely yes @vinothkannans simple is better!

Sometimes I just get carried away :grimacing:

:sunflower:

1 Like

@nixie FYI, as per Joshua’s commit you can use newly added CSS classes .last-ip and .registration-ip.

6 Likes

For those from google looking for the css code:

.last-ip, .registration-ip {
    display: none;
}

Note that this will not really hide the IP address from being sent to the admins’/moderators’ browsers, as the CSS only hides the element; the IP address is still there if they were to inspect element.

3 Likes