# Check for group membership in Header code?

**URL:** <https://meta.discourse.org/t/check-for-group-membership-in-header-code/72642>\
**Category:** UX\
**Created:** [10월 23, 2017, 9:03오후 UTC](https://meta.discourse.org/t/check-for-group-membership-in-header-code/72642 "2017-10-23T21:03:24Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)\
**Post date:** [10월 23, 2017, 9:15오후 UTC](https://meta.discourse.org/t/check-for-group-membership-in-header-code/72642/2 "2017-10-23T21:15:37Z")

</div>

The answer is yes, but the amount of work varies.

By calling

```plaintext
var user = Discourse.User.current();

```

You can get access immediately to their `primary_group_name`, but it won’t provide you with all groups they have access to.

To get all groups, you might have to do a call to `/u/username.json` and read the groups property. That makes it a tad more difficult as now you are awaiting the response of a call before you can show the link.

---

_[View the full topic](https://meta.discourse.org/t/check-for-group-membership-in-header-code/72642)._
