Can I hide an admin?

AI-generated summary

The discussion revolves around hiding an admin user from the staff list in the /about section. SidV wants to conceal an admin user who is an investor, but other users are curious about the reason behind this request. Yuun suggests using CSS to hide the admin, but later realizes this method may not be effective due to dynamically generated div IDs.

Yuun proposes renaming the user to something innocuous as an alternative solution. Meanwhile, riking provides a code snippet for a plugin that can hide specific admin names if the user is self-hosted. Finally, Johani offers a simpler CSS solution using a data-attribute that matches the admin’s username, allowing specific admins to be hidden in the list.

Hello, I need to hide an admin user from the staff list.
I don’t like that he shows in /about section.

How could I do that?

I suppose if you wanted, you could just target the div for that admin on the /about page and set it to display:none in your admin/customize CSS. It seems to work on meta using Chrome’s inspector, at least.

I’ll admit I’m a bit curious as to why you want a secret admin, though.

In this case, I’ve got an investor that want to “see” how this site is going, but now he want to “disappear” :slight_smile:

I’m thinking in change the username and put something like: “Secret admin” :lol:

About CSS, I don’t know how to set up that customization, sorry for my ignorance.

Regards!

Sorry, just went through and double checked with an actual customization, I don’t think applying a CSS rule will be enough since the div ids are, I guess, generated by ember, and are in any case not constant. Maybe there’s something you can do with javascript? Would have to ask someone else though, unfortunately.

What I get for writing out a quick solution without paying enough attention. :smile:

I don’t know that there’s a setting for what you’re looking for, renaming the user to something innocuous would at least be the easiest thing to do.

If you’re self-hosted, this is possible with a plugin.

# plugin header here

module HideAdminNames
  NAMES_TO_HIDE = %w(investordude blahblahblah).freeze
end

after_initialize do
  class About
    def admins
      @admins ||= User.where(admin: true)
                      .where.not(id: Discourse::SYSTEM_USER_ID)
                      .where.not(username_lower: HideAdminNames::NAMES_TO_HIDE)
                      .order(:username_lower)
    end
  end
end

The div that wraps around each admin’s information now has a data-attribute that matches their username. So you can use

.about.admins [data-username="USERNAME"] {
  display: none;
}

to hide specific admins in that list - swap USERNAME with the username of the admin you want to hide.