# 绕过6个徽章收藏限制

**URL:** <https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015>\
**Category:** Self-hosting\
**Created:** [2026年五月1日 15:05 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015 "2026-05-01T15:05:22Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![codixer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codixer/32/507056_2.png) [@codixer](https://meta.discourse.org/u/codixer)\
**Post date:** [2026年五月1日 15:05 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/1 "2026-05-01T15:05:22Z")

</div>

因此，我们的社区对徽章有非常特定的用途……有些社区有 4 枚徽章，这就足够了。

 ![image](https://global.discourse-cdn.com/meta/original/4X/9/6/a/96aa1a39dfa5d34e6dab63500b1ea8f2a6eb0a4b.jpeg)

不过，我们也有用户拥有 24 枚徽章！

![image](https://global.discourse-cdn.com/meta/original/4X/2/6/3/2639d9a31db1ae3a17f1aacc51f64c3cd80e91a8.png)

我想知道是否可以将 `max_favorite_badges` 设置为超过 6：

```r
discourse(prod)> SiteSetting.max_favorite_badges = 50
lib/site_settings/type_supervisor.rb:308:in 'SiteSettings::TypeSupervisor#validate_value': max_favorite_badges: 值必须在 0 到 6 之间。(Discourse::InvalidParameters)

```

---

<div class="post-metadata">

**Author:** ![darkpixlz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darkpixlz/32/549896_2.png) [@darkpixlz](https://meta.discourse.org/u/darkpixlz)\
**Post date:** [2026年五月1日 15:09 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/2 "2026-05-01T15:09:42Z")

</div>

不行。最大值在此处设置：

> <https://github.com/discourse/discourse/blob/main/config/site_settings.yml#L447>

我认为无法更改最大值，它们通常是有特定原因才这样设置的。

---

<div class="post-metadata">

**Author:** ![codixer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codixer/32/507056_2.png) [@codixer](https://meta.discourse.org/u/codixer)\
**Post date:** [2026年五月1日 15:14 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/3 "2026-05-01T15:14:40Z")

</div>

您是否知道是否有办法绕过建议的值？同时考虑到已告知的风险（例如，如果徽章相关部分出现问题，将不提供支持）。

---

<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:** [2026年五月1日 15:16 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/4 "2026-05-01T15:16:34Z")

</div>

请问允许这么多收藏的具体使用场景是什么？  
我认为在用户卡片上显示 24 个徽章（至少默认主题下）会显得过多。您打算在哪里使用这些收藏？也许有替代方案，无需使用此站点设置。例如，[Post Badges 插件](https://meta.discourse.org/t/post-badges/114722/121) 允许用户选择在其帖子中名字旁边显示哪个徽章。

---

<div class="post-metadata">

**Author:** ![darkpixlz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darkpixlz/32/549896_2.png) [@darkpixlz](https://meta.discourse.org/u/darkpixlz)\
**Post date:** [2026年五月1日 15:18 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/5 "2026-05-01T15:18:22Z")

</div>

不，我认为现在这不可行。让人们绕过设定的限制是个坏主意，正如我之前所说，这些限制几乎总是有原因的。

---

<div class="post-metadata">

**Author:** ![codixer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codixer/32/507056_2.png) [@codixer](https://meta.discourse.org/u/codixer)\
**Post date:** [2026年五月1日 15:19 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/6 "2026-05-01T15:19:00Z")

</div>

> [@Moin](#):
>
> 您允许这么多收藏的具体使用场景究竟是什么？

用户希望在其个人资料中展示所有徽章，这是针对特定类型社区的需求。因为用户参与了多项竞赛，或是担任“导师”、“版主”，甚至是“翻译”，他们希望有一个地方能展示所有这些身份。目前我同时拥有群组徽章和常规徽章，但只能在帖子中显示单个群组图标，并在用户卡片上显示徽章（共6个）。

---

<div class="post-metadata">

**Author:** ![codixer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codixer/32/507056_2.png) [@codixer](https://meta.discourse.org/u/codixer)\
**Post date:** [2026年五月1日 15:22 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/8 "2026-05-01T15:22:29Z")

</div>

> [@Moin](#):
>
> 也许有替代这个站点设置的方案。例如，[帖子徽章插件](https://meta.discourse.org/t/post-badges/114722/121) 允许用户选择在其帖子中姓名旁显示哪一枚徽章。

我查看了一下，所有（由管理员创建的）徽章默认都需要显示。而且该插件似乎不支持这一功能。

 ![image](https://global.discourse-cdn.com/meta/original/4X/b/3/f/b3fd6d6a5a102e63b36feee4ef99420f9421ba6e.png)

这非常特定于社区，因为该社区在平台（Resonite）上处理徽章的方式如此。因此，这是一个非常具体的请求：😛

---

<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:** [2026年五月1日 15:24 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/9 "2026-05-01T15:24:23Z")

</div>

> [@codixer](#):
>
> 用户希望在自己的个人资料页面上显示所有徽章

他们所有的徽章在个人资料页面上都是可见的。你可以在这里看到我的所有徽章：[https://meta.discourse.org/u/moin/badges](https://meta.discourse.org/u/moin/badges)。

> [@codixer](#):
>
> 我已经查看过了，

是指我链接的插件，还是主题组件？  
这可能不完全符合你的需求，但它或许可以作为实现你所需功能的良好起点。

---

<div class="post-metadata">

**Author:** ![codixer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codixer/32/507056_2.png) [@codixer](https://meta.discourse.org/u/codixer)\
**Post date:** [2026年五月1日 15:25 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/10 "2026-05-01T15:25:27Z")

</div>

> [@Moin](#):
>
> 是指我链接的那个插件，还是主题组件？

~~插件，你没有链接主题组件……我想是吧。~~

我眼花了，你称之为插件，但它确实是一个主题组件。那么在这种情况下，指的是组件。

再次确认，我可以通过组件来实现，但仍需手动添加全部约 160 个徽章。详见：

> **[Disconite - Resonite Community Forum](https://disconite.net/badges)**
>
> A unofficial commmunity ran, owned and managed forum for the game Resonite.

---

<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:** [2026年五月1日 15:29 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/11 "2026-05-01T15:29:22Z")

</div>

我之所以称之为插件，是因为我链接的帖子中包含一个插件。这并非我的错，因为它是在主题组件的讨论范围内被提及的 🤷

该插件允许用户自行选择徽章，而在此组件中，则由管理员决定显示哪些徽章。我以为这个插件可能更接近于选择收藏的功能。

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [2026年五月1日 15:44 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/12 "2026-05-01T15:44:17Z")

</div>

通过自定义插件，或结合一些 Rails 命令及相应的 CSS 来修复布局问题，将数量增加到十几个应该是可行的。但增加到 50 个会导致 JSON 负载膨胀，并引发诸多问题。我认为，默认硬编码的徽章数量上限若要提高，会非常脆弱。

---

<div class="post-metadata">

**Author:** ![darkpixlz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darkpixlz/32/549896_2.png) [@darkpixlz](https://meta.discourse.org/u/darkpixlz)\
**Post date:** [2026年五月1日 16:04 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/13 "2026-05-01T16:04:32Z")

</div>

我查看了您的网站，其中很多内容其实可以设置为自助式群组，甚至直接作为用户自定义字段（比如性取向/残障类型等）。徽章本应代表成就，就像其他已有的徽章那样。

除非您认为旗帜标识非常重要，否则我建议将此类内容直接设为用户字段。

---

<div class="post-metadata">

**Author:** ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)\
**Post date:** [2026年五月1日 16:18 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/14 "2026-05-01T16:18:21Z")

</div>

> [@darkpixlz](#):
>
> 它们通常这样设置是有原因的。

> [@darkpixlz](#):
>
> 几乎总是有原因的。

确实如此。在我看来，如果知道原因™，通常最好分享出来 🙂  
可能是为了可读性，可能是为了请求优化，也可能是两者兼有，或者其他原因，等等。  
就我个人而言，当有人询问某事并在某个时候得到原因™的解释时，我总是感到很满意 😄  
有时，甚至原因™也可以被用户合理地提出质疑 🙂

* * *

@codixer 如果无法通过界面提高限制，那么发布到 #Contribute > Feature 是正确做法（或者你可以尝试插件方式，但我不确定即使使用插件是否能覆盖此设置）。  
如果该主题没有引起关注，也没有其他人提出此需求（尤其是客户），那么发生变化的可能性很小，但提出功能请求总不会有害！  
和许多人一样，我也曾偶尔提出过一些功能请求，即使我认为自己的点子非常棒，却也没有获得任何点赞或投票 😛

---

<div class="post-metadata">

**Author:** ![codixer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codixer/32/507056_2.png) [@codixer](https://meta.discourse.org/u/codixer)\
**Post date:** [2026年五月1日 16:41 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/15 "2026-05-01T16:41:46Z")

</div>

是的，我在寻找一种能根据用户所属组来显示内容的方案。而仅基于主组的方法确实行不通。有其他替代方案吗？

---

<div class="post-metadata">

**Author:** ![codixer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codixer/32/507056_2.png) [@codixer](https://meta.discourse.org/u/codixer)\
**Post date:** [2026年五月1日 16:44 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/16 "2026-05-01T16:44:15Z")

</div>

它们和实际平台一样。如果你有替代方案，我随时欢迎 😃

---

<div class="post-metadata">

**Author:** ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)\
**Post date:** [2026年五月1日 16:51 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/17 "2026-05-01T16:51:54Z")

</div>

如果您有预算且需要此服务，请在 #Marketplace 中发帖，我或许能提供帮助。

---

<div class="post-metadata">

**Author:** ![darkpixlz](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/darkpixlz/32/549896_2.png) [@darkpixlz](https://meta.discourse.org/u/darkpixlz)\
**Post date:** [2026年五月1日 17:03 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/18 "2026-05-01T17:03:41Z")

</div>

> [@Canapin](#):
>
> 确实如此。在我看来，如果知道的话，通常最好说明一下原因™ 🙂

如果我知道的话，我会出于和你同样的原因说出来 😭 我只是觉得这个数字 6 无论如何总会在某个时候被选定。如果非要我完全瞎猜的话，可能是为了用户卡（因为 6 已经很多了）的可读性，但工作人员应该比我更清楚 🙂

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2026年五月2日 10:52 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/19 "2026-05-02T10:52:25Z")

</div>

在插件中修改并不困难。也可以通过在 app.yml 中使用 replace 语句块来修改配置文件。

鉴于上述所有原因，这可能不是一个好主意。

---

<div class="post-metadata">

**Author:** ![codixer](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codixer/32/507056_2.png) [@codixer](https://meta.discourse.org/u/codixer)\
**Post date:** [2026年五月2日 11:01 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/20 "2026-05-02T11:01:40Z")

</div>

有人在使用 Discourse 现有功能集的情况下有替代方案吗？

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2026年五月2日 16:39 UTC](https://meta.discourse.org/t/bypass-the-6-badge-fav-limit/402015/21 "2026-05-02T16:39:11Z")

</div>

> [@codixer](#):
>
> 有人能利用 Discourse 现有的功能提供替代方案吗？

所以，你真正想要的是根据用户所属组的徽章，在用户卡片和/或个人资料页面上添加多个徽章样式？一个主题组件就可以实现这一点。你根本不需要使用徽章。
