# Advice on a hide admin from about page theme component--is this going to slow things down?

**URL:** https://meta.discourse.org/t/advice-on-a-hide-admin-from-about-page-theme-component-is-this-going-to-slow-things-down/256877
**Category:** Development
**Created:** [March 2, 2023, 8:19pm UTC](https://meta.discourse.org/t/advice-on-a-hide-admin-from-about-page-theme-component-is-this-going-to-slow-things-down/256877 "2023-03-02T20:19:07Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [March 2, 2023, 8:19pm UTC](https://meta.discourse.org/t/advice-on-a-hide-admin-from-about-page-theme-component-is-this-going-to-slow-things-down/256877/1 "2023-03-02T20:19:07Z")

</div>

I’m wanting to remove my user from the about page of some sites I manage. I’m not the one who’s going to delete your account, or anything else. . .

One way is this:

> [@How to hide admins from /about page](https://meta.discourse.org/t/how-to-hide-admins-from-about-page/43678/2):
>
> Since we often have to be admin to diagnose issues or change settings on our customer’s Discourse, we decided to hide all our @discourse.org accounts from the admins lists. That way, we’re not polluting our customer’s admins lists. We do this using a plugin that is automatically installed to all the Discourse we host and does something like after\_initialize do add\_to\_serializer(:about, :admins) do object.admins.reject { |u| u.email =~ /@discourse\.org/i } end end

But a plugin seems a bit heavy-handed these days, so I have a theme component that does this:

```plaintext
import { withPluginApi } from "discourse/lib/plugin-api";

const hidden_admins = settings.hidden_admins.split("|");
const PLUGIN_ID = "hide-admins";

export default {
  name: "theme-javascript-initializer",
  initialize() {
    withPluginApi("0.8.30", (api) => {
      api.onPageChange((url) => {
        if (url != "/about") {
          return;
        }
        for (const admin of hidden_admins) {
          var element = document.querySelector(`[data-username=${admin}]`);
          if (element === null) {
            break;
          }
          element.classList.add("hide-me");
        }
      });
    });
  },
};

```

Is that stupid for some reason? Does that onPageChange cost very much? The plugin would affect only the about serializer, this does a check on every page change. Is that bad?

There was a topic about just this issue lately that just hard-coded the user in the CSS. Would having just a single CSS in a theme that just did:

```plaintext
.about-page div[data-username="pfaffman"] {
  display: none !important;
}

```

be better? It wouldn’t be useful for anyone other than me, which is why I sort of like this theme component idea.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [March 2, 2023, 8:21pm UTC](https://meta.discourse.org/t/advice-on-a-hide-admin-from-about-page-theme-component-is-this-going-to-slow-things-down/256877/2 "2023-03-02T20:21:12Z")

</div>

So for every page turn except “about” you are processing ~two lines of extra javascript?

No I don’t think that is bad given the enormous amount of javascript that runs all the time on Discourse 🙂

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [March 2, 2023, 8:22pm UTC](https://meta.discourse.org/t/advice-on-a-hide-admin-from-about-page-theme-component-is-this-going-to-slow-things-down/256877/3 "2023-03-02T20:22:52Z")

</div>

That’s mostly what I thought, but I very much appreciate your confirmation. I’ll see about prettying this thing up a bit and making it public and then writing tooling to automate adding it to some sites.

Thanks very much.

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [March 2, 2023, 9:58pm UTC](https://meta.discourse.org/t/advice-on-a-hide-admin-from-about-page-theme-component-is-this-going-to-slow-things-down/256877/4 "2023-03-02T21:58:04Z")

</div>

So Jay would this be a plugin to install or a Theme-component?

I think this could be handy to even extend functionality to even Mods. For some use cases.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [March 2, 2023, 11:09pm UTC](https://meta.discourse.org/t/advice-on-a-hide-admin-from-about-page-theme-component-is-this-going-to-slow-things-down/256877/5 "2023-03-02T23:09:33Z")

</div>

This is a theme component. I’m still cleaning it up a bit. I’ll make a proper theme page for it on the next while, but you can see [GitHub - literatecomputing/discourse-hide-admins-about: Theme component to hide some admin users from about page · GitHub](https://github.com/literatecomputing/discourse-hide-admins-about) if you’re excited to try it out.

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [March 2, 2023, 11:22pm UTC](https://meta.discourse.org/t/advice-on-a-hide-admin-from-about-page-theme-component-is-this-going-to-slow-things-down/256877/6 "2023-03-02T23:22:32Z")

</div>

That is quite cool. I am content though to wait for your official roll out.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [April 1, 2023, 11:22pm UTC](https://meta.discourse.org/t/advice-on-a-hide-admin-from-about-page-theme-component-is-this-going-to-slow-things-down/256877/7 "2023-04-01T23:22:54Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
