Accessing the Admin Panel in the Source Code

AI-generated summary

The discussion is about accessing the Admin Panel in the Discourse Source Code to hide User IP Addresses from moderators and admins. Marshably is trying to make this change but is having trouble locating the relevant code and making the changes stick. Arkshine provides a possible location for the code, but Marshably still encounters issues after making the changes. simon advises against editing the source code and suggests using a plugin instead. Marshably explains that the goal is to prevent moderators from viewing IP addresses due to community concerns, but simon suggests using category moderators as an alternative solution. RGJ notes that trust issues between the community and moderators should be addressed in a non-technical way.

Hi all!

I wonder if anyone can help me locate where the User Info part of the Admin Panel is located in the Discourse Source Code. I need to make an edit to the Source Code that will hide User IP Addresses when a Moderator or Admin views their Profile from the Admin Panel but I have no idea where I can find the code that relates to this.

Any help would be hugely appreciated.

Thank you all in advance!

Hi, welcome! :wave:

Do you mean here?

If so, it should be here:
https://github.com/discourse/discourse/blob/main/app/assets/javascripts/admin/addon/templates/user-index.hbs#L180-L201

For some reason I still cannot locate it based on what you have given me.

But yes, that is exactly what I meant.

I eventually managed to find this, but for some unknown reason, after deleting those lines of Code and restarting the VPS, the IPs still show up?

Editing the Discourse source code isn’t the recommended way to make changes to Discourse. I think you are going to have to find a way to make the change in a plugin.

What happened when you restarted Discourse will depend on how you restarted it. If you ran ./launcher rebuild app, then the changes you made will have been overwritten from the Discourse base image. If you ran ./launcher start app, it may be that starting the app isn’t enough to get Discourse to recompile the edited handlebars template.

Do you really need to prevent moderators and admins from viewing user’s IP addresses? There are a few requests on this site to add a setting that prevents moderators from viewing IP address. I’m not aware of other sites wanting to prevent admins from viewing IP addresses.

I wanted to prevent Moderators from viewing the IP Addresses as my community is not going to become larger than maybe 100 Users and some of them are upset over the fact that IP Addresses are collected (I’ve already explained every website collects their IP and some sell it). So I decided to attempt to remove it completely however that has not yet worked.

Instead of trying to hide IP addresses from moderators, maybe you could just use category moderators to handle the site’s moderation. That way only admins would be able to view IP addresses. Details about Category moderation are here:

There’s a feature request about hiding IP addresses from moderators here: Option to hide IP addresses from moderators.

If there are trust issues between your community and the moderator team then you will need to solve those in a non-technical way, not work around them with technology. These kind of things tend to blow up in another fashion sooner or later.