# ユーザーのグループメンバーシップに基づいてトピック内で異なるコンテンツを表示しますか？

**URL:** https://meta.discourse.org/t/display-different-content-within-a-topic-based-on-users-groups-membership/227075
**Category:** Development
**Created:** [2022 年 5 月 15 日午後 12:01 UTC](https://meta.discourse.org/t/display-different-content-within-a-topic-based-on-users-groups-membership/227075 "2022-05-15T12:01:25Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![craigconstantine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/craigconstantine/32/511195_2.png) [@craigconstantine](https://meta.discourse.org/u/craigconstantine)
#### Post date: [2022 年 10 月 21 日午後 6:48 UTC](https://meta.discourse.org/t/display-different-content-within-a-topic-based-on-users-groups-membership/227075/6 "2022-10-21T18:48:32Z")

</div>

ついにこれをまとめる時間ができました。\u003chttps://github.com/Umbrella-CAST/discourse-umbrella-groupswitchdisplay\u003e とてもシンプルで、現在のユーザーが「foobar」というグループに属しているか、または「!foobar」でグループに属していないかに基づいて、対象のDIVをDOMから削除するだけです。これにより、下の画像のようなコンテンツの表示を簡単に切り替えることができます。

もちろん、コンポーネントが無効になっている場合、すべてのコンテンツが表示されます（コンポーネントがないため、DOMはトリミングされません）。しかし、これは私がやりたいことには十分です。

 ![Screen Shot 2022-10-21 at 14.45.00](https://global.discourse-cdn.com/meta/original/4X/8/a/c/8ac929ad9267b6c6544b976da4bbe4a79655a2fc.jpeg)

---

_[View the full topic](https://meta.discourse.org/t/display-different-content-within-a-topic-based-on-users-groups-membership/227075)._
