# Simple Script to Show / Hide Content Based on Group

**URL:** <https://meta.discourse.org/t/simple-script-to-show-hide-content-based-on-group/74761>\
**Category:** Support\
**Created:** [24 Novembre 2017, 8:43pm UTC](https://meta.discourse.org/t/simple-script-to-show-hide-content-based-on-group/74761 "2017-11-24T20:43:54Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![8BIT](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/8bit/32/76872_2.png) [@8BIT](https://meta.discourse.org/u/8BIT)\
**Post date:** [24 Novembre 2017, 8:43pm UTC](https://meta.discourse.org/t/simple-script-to-show-hide-content-based-on-group/74761/1 "2017-11-24T20:43:55Z")

</div>

Maybe a little spot-check here…

I was given this for advertising:

```plaintext
<script src="//m.servedby-buysellads.com/monetization.js" type="text/javascript"></script>
    <script>
(function(){
    if(typeof _bsa !== 'undefined' && _bsa) {
        _bsa.init('fancybar', 'CKYDV2QM', 'placement:thebitcoinpub');
    }
})();
</script>

```

And I’d like to show this code to _everyone_ except those who are in the Group “[patrons](https://thebitcoin.pub/groups/patrons)” (using the Patreon Plugin).

Does this look right?

```plaintext
<script src="//m.servedby-buysellads.com/monetization.js" type="text/javascript"></script>
    <script>
const user = Discourse.User.current(); 
(function(){
    if ((typeof _bsa !== 'undefined' && _bsa && user === null) || typeof _bsa !== 'undefined' && _bsa && user !== null && user.primary_group_name !== "patrons") {
        _bsa.init('fancybar', 'CKYDV2QM', 'placement:thebitcoinpub'); }

    }
  }
})();
</script>

```

This doesn’t seem to give the result that I’m looking for… is there a better way of doing this?

Thanks in advance!

---

_[View the full topic](https://meta.discourse.org/t/simple-script-to-show-hide-content-based-on-group/74761)._
