# Show component only to a specific group via script?

**URL:** https://meta.discourse.org/t/show-component-only-to-a-specific-group-via-script/218906
**Category:** Support
**Created:** [February 20, 2022, 10:17pm UTC](https://meta.discourse.org/t/show-component-only-to-a-specific-group-via-script/218906 "2022-02-20T22:17:22Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![InSync](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/insync/32/250625_2.png) [@InSync](https://meta.discourse.org/u/InSync)
#### Post date: [February 20, 2022, 10:17pm UTC](https://meta.discourse.org/t/show-component-only-to-a-specific-group-via-script/218906/1 "2022-02-20T22:17:22Z")

</div>

Hey 🖖

I want to create a component (header) in a theme that will only be visible to a certain group of users.

I’m use this script:

```plaintext
<script type='text/x-handlebars' data-template-name='/connectors/above-main-container/test'>
  {{#if currentUser}}
     <h1>Hello, {{currentUser.username}}!</h1>
  {{/if}}
</script>

```

What should I replace this parameter ` {{#if currentUser}}` with so that only users from group “HackOneGroup” can see the component?

I try this `{{#if group.name === "HackOneGroup"}}` but it’s wot work.

Please help 🥺 🙏

---

<div class="post-metadata">

### Author: ![IAmGav](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/iamgav/32/235598_2.png) [@IAmGav](https://meta.discourse.org/u/IAmGav)
#### Post date: [February 20, 2022, 10:52pm UTC](https://meta.discourse.org/t/show-component-only-to-a-specific-group-via-script/218906/2 "2022-02-20T22:52:03Z")

</div>

maybe this will interest you

> [@Topic Banners component](https://meta.discourse.org/t/topic-banners-component/216229):
>
> This component lets you render any topic as a banner on custom url paths. The default look is pretty basic. The screenshot shows the default Welcome topic as a banner on the Latest list: But banners will render various content that is supported on topics, e.g. emojis, animations, video links.. So you could use (and abuse) this in many ways see_no_evil In Settings, you select views by their relative url and topics by their id. You can also position the…

---

<div class="post-metadata">

### Author: ![Alexander](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alexander/32/497634_2.png) [@Alexander](https://meta.discourse.org/u/Alexander)
#### Post date: [February 20, 2022, 11:01pm UTC](https://meta.discourse.org/t/show-component-only-to-a-specific-group-via-script/218906/3 "2022-02-20T23:01:04Z")

</div>

> <https://github.com/nolosb/discourse-topic-banners/blob/main/javascripts/discourse/widgets/topic-banners.js#L39>

I think it might be similar to this what you are looking for 🤔

---

<div class="post-metadata">

### Author: ![InSync](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/insync/32/250625_2.png) [@InSync](https://meta.discourse.org/u/InSync)
#### Post date: [February 20, 2022, 11:43pm UTC](https://meta.discourse.org/t/show-component-only-to-a-specific-group-via-script/218906/4 "2022-02-20T23:43:50Z")

</div>

I found this `{{#if currentUser.staff}}` it’s work and show content only for the staff, but it’s didn’t work if I change _staff_ to other, example: `{{#if currentUser.trust_level_0}}` 😕

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [August 16, 2022, 7:44am UTC](https://meta.discourse.org/t/show-component-only-to-a-specific-group-via-script/218906/5 "2022-08-16T07:44:16Z")

</div>

Would the [CSS Classes for Current User's Groups](https://meta.discourse.org/t/css-classes-for-current-users-groups/226068) theme component help?
