# 用户自定义字段切换侧边栏（SFW模式）

**URL:** https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342
**Category:** Marketplace
**Created:** [2023年三月7日 09:14 UTC](https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342 "2023-03-07T09:14:24Z")
**Posts on this page:** 1
**Showing post:** 9

<div class="post-metadata">

### Author: ![kinetiksoft](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kinetiksoft/32/229578_2.png) [@kinetiksoft](https://meta.discourse.org/u/kinetiksoft)
#### Post date: [2023年三月7日 15:30 UTC](https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342/9 "2023-03-07T15:30:53Z")

</div>

好的，我现在明白了。嗯，你似乎在为我在第一篇帖子中提到的这个解决方案发明轮子：[Our solution for blurring NSFW content](https://meta.discourse.org/t/our-solution-for-blurring-nsfw-content/124584)

它实现了你所说的功能。它会查看用户的字段值，并通过 JS 设置 CSS 类。请确保你使用[此消息中的代码](https://meta.discourse.org/t/our-solution-for-blurring-nsfw-content/124584/5?u=kinetiksoft)作为基础，因为第一个帖子中使用的代码依赖于已弃用的 Discourse 方法。

此外，你还可以看看这个：[https://meta.discourse.org/t/css-classes-for-current-users-groups/226068，根据用户的群组调整你网站的外观和功能](https://meta.discourse.org/t/css-classes-for-current-users-groups/226068%EF%BC%8C%E6%A0%B9%E6%8D%AE%E7%94%A8%E6%88%B7%E7%9A%84%E7%BE%A4%E7%BB%84%E8%B0%83%E6%95%B4%E4%BD%A0%E7%BD%91%E7%AB%99%E7%9A%84%E5%A4%96%E8%A7%82%E5%92%8C%E5%8A%9F%E8%83%BD) 🙂

---

_[View the full topic](https://meta.discourse.org/t/user-custom-field-toggle-for-sidebar-sfw-mode/257342)._
