Show component only to a specific group via script?

Hey :vulcan_salute:

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:

<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 :pleading_face: :pray:

maybe this will interest you

3 Likes

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

3 Likes

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}} :confused:

Would the CSS Classes for Current User's Groups theme component help?

2 Likes