# 根据组覆盖用户配置文件模板

**URL:** <https://meta.discourse.org/t/override-user-profile-template-based-on-group/253528>\
**Category:** Development\
**Created:** [2023年一月31日 16:11 UTC](https://meta.discourse.org/t/override-user-profile-template-based-on-group/253528 "2023-01-31T16:11:59Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![asc](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/asc/32/288324_2.png) [@asc](https://meta.discourse.org/u/asc)\
**Post date:** [2023年二月4日 19:22 UTC](https://meta.discourse.org/t/override-user-profile-template-based-on-group/253528/2 "2023-02-04T19:22:28Z")

</div>

如果其他人看到此内容，我最终的做法是覆盖 user、user/summary 和 user/activity 的模板，通过在我不希望已登录用户看到的部分周围添加 `{{#if (or viewingSelf currentUser.staff)}}` 来实现。这会覆盖所有用户的个人资料模板，而不仅仅是指定组中的用户，但我认为这对于我的用例来说已经足够了，可以给用户更多的通用隐私。我制定的模板仍然允许用户选择置顶一个主题，但会隐藏所有其他摘要统计信息、主题和活动，除非用户自己和工作人员查看。

我的用例与[这个关于课堂匿名模式的主题](https://meta.discourse.org/t/questions-about-improvements-to-anonymous-mode/155944)类似，即希望有一种易于访问的方式，让用户或管理员能够更精细地控制即使对于已登录用户，个人资料的哪些部分可以显示或隐藏。例如，在一个健康支持小组论坛中，希望匿名账户在 anon 组中，然后配置为不向 anon 组显示活动页面或选项卡。

---

_[View the full topic](https://meta.discourse.org/t/override-user-profile-template-based-on-group/253528)._
