Can I hide an admin?


#1

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?


How to hide admins from /about page
(Sam) #2

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.


#3

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!


(Sam) #4

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.


(Kane York) #5

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

(system) #6

(Joe) #7

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.


(Joe) #8