# Fallback for \`user\_in\_X\` theme setting support fails when resolved value is false

**URL:** https://meta.discourse.org/t/fallback-for-user-in-x-theme-setting-support-fails-when-resolved-value-is-false/408524
**Category:** Bug
**Tags:** copy-post
**Created:** [July 26, 2026, 12:08am UTC](https://meta.discourse.org/t/fallback-for-user-in-x-theme-setting-support-fails-when-resolved-value-is-false/408524 "2026-07-26T00:08:58Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [July 26, 2026, 12:08am UTC](https://meta.discourse.org/t/fallback-for-user-in-x-theme-setting-support-fails-when-resolved-value-is-false/408524/1 "2026-07-26T00:08:58Z")

</div>

> [@Granular group-based permissions for anonymous and logged in users](https://meta.discourse.org/t/granular-group-based-permissions-for-anonymous-and-logged-in-users/402273/14):
>
> I’ve fixed discourse-copy-post with [DEV: Use resolve\_group\_membership core theme functionality - Pull Request #37 - discourse/discourse-copy-post - GitHub](https://github.com/discourse/discourse-copy-post/pull/37) and now I am going through our other official plugins to see if any others need the same treatment (e.g. you already pointed to [GitHub - discourse/discourse-unanswered-filter · GitHub](https://github.com/discourse/discourse-unanswered-filter) )
> 
> For your own [Filter Favorites](https://meta.discourse.org/t/filter-favorites/386594) , you can see the copy-post example I did

I tried that now, but I think I noticed an issue while testing:  
If a user is not in any of the allowed groups, the new check for `user_in_copy_button_allowed_groups` does not return a result. So, the fallback code for forums which cannot yet handle `user_in_setting` is executed but fails:

```plaintext
[THEME 254 'Copy post button'] TypeError: Cannot read properties of undefined (reading 'split')

```

Steps to reproduce:

1. Install the component and add it to your theme
2. Limit the allowed\_groups to admins
3. Impersonate a non-admin test user and check the browser console

I think the issue is here:

```js
if (Object.hasOwn(settings, "user_in_copy_button_allowed_groups")) {
    if (settings.user_in_copy_button_allowed_groups) {
      return true;
    }
  }

```

This only returns early when the value is `true`. When it’s `false`, the fallback code below is executed, which expects the setting value to still exist as a string - but in my testing with my \[1\] component where I copied the fallback pattern from copy-post, it’s `undefined` once `user_in_X` support is active. I’d guess the fix is to return `false` in that case too, so the fallback is only used when the `user_in_X` key doesn’t exist at all (older core), not whenever the resolved value happens to be `false`.

Is my assumption correct, or is the setting still expected to provide the groups as a string?

* * *

1. prefilled composer link

---

<div class="post-metadata">

### Author: ![martin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martin/32/491371_2.png) [@martin](https://meta.discourse.org/u/martin)
#### Post date: [July 27, 2026, 1:41am UTC](https://meta.discourse.org/t/fallback-for-user-in-x-theme-setting-support-fails-when-resolved-value-is-false/408524/3 "2026-07-27T01:41:19Z")

</div>

Oh thanks for raising this, I’ve just made a dumb mistake in the theme component. This:

```javascript
if (settings.user_in_copy_button_allowed_groups) {
  return true;
}

```

Should be:

```javascript
return settings.user_in_copy_button_allowed_groups;

```

The fallback should only happen when `Object.hasOwn(settings, "user_in_copy_button_allowed_groups")` is false. Will go fix these components I added this stuff to…

---

<div class="post-metadata">

### Author: ![martin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martin/32/491371_2.png) [@martin](https://meta.discourse.org/u/martin)
#### Post date: [July 27, 2026, 1:53am UTC](https://meta.discourse.org/t/fallback-for-user-in-x-theme-setting-support-fails-when-resolved-value-is-false/408524/4 "2026-07-27T01:53:28Z")

</div>

Here is the fix:

> <https://github.com/discourse/discourse-copy-post/pull/38>
>
> Followup 2a8ba5039d9557e50ce3b9049b554a022e2406e8
> 
> Was not doing the early ret…urn correctly

I actually did it properly in the PR for Lilly’s TC, so nothing else to do there:

 ![image](https://global.discourse-cdn.com/meta/original/4X/5/1/3/5132fa05f8811edd82fc903da9bfb7c8478643ed.png)

---

<div class="post-metadata">

### Author: ![martin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/martin/32/491371_2.png) [@martin](https://meta.discourse.org/u/martin)
#### Post date: [July 30, 2026, 4:23am UTC](https://meta.discourse.org/t/fallback-for-user-in-x-theme-setting-support-fails-when-resolved-value-is-false/408524/5 "2026-07-30T04:23:35Z")

</div>


