# User JS Object \`groups\` array not populated for several users

**URL:** <https://meta.discourse.org/t/user-js-object-groups-array-not-populated-for-several-users/261520>\
**Category:** Development\
**Created:** [April 13, 2023, 2:02am UTC](https://meta.discourse.org/t/user-js-object-groups-array-not-populated-for-several-users/261520 "2023-04-13T02:02:24Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![smileBeda](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/smilebeda/32/272497_2.png) [@smileBeda](https://meta.discourse.org/u/smileBeda)\
**Post date:** [April 13, 2023, 6:27am UTC](https://meta.discourse.org/t/user-js-object-groups-array-not-populated-for-several-users/261520/7 "2023-04-13T06:27:36Z")

</div>

Thanks all

While on this particular instance the `groups` still remains empty (even with the api of the user instead of the current session), I was able to achieve this by checking on the group _ID_ in the `group_users` which as well stores the same data, just not with name

I did use my original approach to get the data as this is “just” a snippet added in Discourse as a `head` script, no theme or plugin.  
I couldn’t get the actual `api` to work, but the AJAX approach works just as fine for what I needed it.

Thanks again all for the inputs, specially @Lhc_fl whose approach led me to the right solution for my case.

---

_[View the full topic](https://meta.discourse.org/t/user-js-object-groups-array-not-populated-for-several-users/261520)._
