# 限制特定类别中的点赞数

**URL:** https://meta.discourse.org/t/limiting-likes-in-a-specific-category/223697
**Category:** Support
**Created:** [2022年四月8日 07:55 UTC](https://meta.discourse.org/t/limiting-likes-in-a-specific-category/223697 "2022-04-08T07:55:54Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Shirly\_Nowak](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shirly_nowak/32/571731_2.png) [@Shirly\_Nowak](https://meta.discourse.org/u/Shirly_Nowak)
#### Post date: [2022年四月8日 07:55 UTC](https://meta.discourse.org/t/limiting-likes-in-a-specific-category/223697/1 "2022-04-08T07:55:54Z")

</div>

大家好！

在尝试找出一种方法来[限制信任级别](https://meta.discourse.org/t/exclude-certain-categories-from-the-trust-levels/222513)之后，并意识到这对我们来说是一个复杂的问题，我们正在考虑 **限制或避免在特定类别中点赞** 的选项。由于点赞会计入信任级别，因此这可能很有用，这样在特定类别中用户就不能点赞（它将只是一个阅读和回复类别，不能发布新内容）。

这样一来，点赞就只在类别之外计算，因此该类别中的活动不足以提升信任级别。

大家对此有什么想法吗？

如果不行的话，我正在考虑一个选项：是否可以在此选项卡（类别 \> 安全）中也添加一个“点赞”选项，这样当我调整某个类别时，我可以定义X个用户不能在该类别中点赞？

 ![Editar_ Sueldo Pasivo - Comunidad Metadigitales](https://global.discourse-cdn.com/meta/original/4X/c/c/c/ccc4bf36c91dc6f9514006339c47833f6da1f09c.png)

非常感谢任何帮助！！

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [2022年四月8日 09:31 UTC](https://meta.discourse.org/t/limiting-likes-in-a-specific-category/223697/2 "2022-04-08T09:31:07Z")

</div>

据我所知，你不能——但我对此没有更深入的了解。

但是……有没有更简单的方法？你的用户真的需要TL3自动提供的所有工具吗？那么你可以将用户限制在TL2，然后手动为那些有意志、有需求和知识使用这些工具的少数人授予TL3。

这样一来，他们发送或收到的点赞数量就无关紧要了。

---

<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: [2022年四月8日 10:18 UTC](https://meta.discourse.org/t/limiting-likes-in-a-specific-category/223697/3 "2022-04-08T10:18:51Z")

</div>

使用 CSS 可以很容易地隐藏某个分类中的“点赞”按钮。

---

<div class="post-metadata">

### Author: ![Shirly\_Nowak](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shirly_nowak/32/571731_2.png) [@Shirly\_Nowak](https://meta.discourse.org/u/Shirly_Nowak)
#### Post date: [2022年四月8日 11:16 UTC](https://meta.discourse.org/t/limiting-likes-in-a-specific-category/223697/4 "2022-04-08T11:16:54Z")

</div>

真的吗？那段代码可以在哪里找到？@pfaffman 非常感谢你，你总是那么乐于助人！🙂

---

<div class="post-metadata">

### Author: ![Shirly\_Nowak](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shirly_nowak/32/571731_2.png) [@Shirly\_Nowak](https://meta.discourse.org/u/Shirly_Nowak)
#### Post date: [2022年四月8日 11:44 UTC](https://meta.discourse.org/t/limiting-likes-in-a-specific-category/223697/5 "2022-04-08T11:44:11Z")

</div>

> [@Jagster](#):
>
> 据我所知，你不能——但我对此没有更深入的了解。
> 
> 但是……有没有简单的办法？你的用户真的需要更高TL自动赋予的所有工具吗？那么你可以将用户限制在TL2，然后手动为那些有决心、有需求且有知识使用这些工具的少数人授予TL3。
> 
> 那样的话，他们送出或收到了多少个赞就无关紧要了。

感谢@Jagster提出的建议，这可能是一个选择，但这是一个相当大的社区，我们需要TL3是自动化的。

> [@pfaffman](#):
>
> 用CSS隐藏某个分类中的点赞按钮应该很简单。

@pfaffman提出的这个选项似乎能解决我所有的问题，我真不敢相信我花了这么长时间才想到这一点 😅

---

<div class="post-metadata">

### Author: ![Shirly\_Nowak](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shirly_nowak/32/571731_2.png) [@Shirly\_Nowak](https://meta.discourse.org/u/Shirly_Nowak)
#### Post date: [2022年四月8日 11:45 UTC](https://meta.discourse.org/t/limiting-likes-in-a-specific-category/223697/6 "2022-04-08T11:45:51Z")

</div>

> [@pfaffman](#):
>
> 在某个类别中使用 CSS 来隐藏点赞按钮会相当简单。

顺便问一下，如果这个问题太明显，请原谅，但我理解 t 会隐藏指定类别中每个帖子或回复的点赞按钮，对吗？

如果是这样，你真是帮了我大忙！

![Excited Season 2 GIF by The Office](https://global.discourse-cdn.com/meta/original/4X/0/a/e/0aea35461335dd88443c2643b10dd54220ec006a.webp)

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [2022年四月8日 11:46 UTC](https://meta.discourse.org/t/limiting-likes-in-a-specific-category/223697/7 "2022-04-08T11:46:37Z")

</div>

只需将此添加到主题组件的 CSS 中，替换 SLUG 为类别的 slug。

```css
body.category-SLUG button.toggle-like {
  display: none;
}

```

---

<div class="post-metadata">

### Author: ![Shirly\_Nowak](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shirly_nowak/32/571731_2.png) [@Shirly\_Nowak](https://meta.discourse.org/u/Shirly_Nowak)
#### Post date: [2022年四月8日 13:17 UTC](https://meta.discourse.org/t/limiting-likes-in-a-specific-category/223697/8 "2022-04-08T13:17:17Z")

</div>

非常感谢你，Richard，这完美地解决了我的所有问题 😃

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [2022年四月8日 14:21 UTC](https://meta.discourse.org/t/limiting-likes-in-a-specific-category/223697/9 "2022-04-08T14:21:43Z")

</div>

但这会彻底阻止对某些类别的点赞，而不是限制。当然，如果你得到了你所需要的，那确实是完美的解决方案。

---

<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: [2022年四月8日 17:56 UTC](https://meta.discourse.org/t/limiting-likes-in-a-specific-category/223697/10 "2022-04-08T17:56:21Z")

</div>

是的，它完全限制了该类别的点赞。这是一个很小的 CSS 问题。

限制特定类别的点赞数量需要一个不容易编写的插件。

---

<div class="post-metadata">

### Author: ![saquetim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saquetim/32/116400_2.png) [@saquetim](https://meta.discourse.org/u/saquetim)
#### Post date: [2022年四月8日 18:32 UTC](https://meta.discourse.org/t/limiting-likes-in-a-specific-category/223697/11 "2022-04-08T18:32:11Z")

</div>

需要注意的是，CSS 仅隐藏了 UI 中的按钮。

用户仍然可以使用浏览器的开发者工具重新显示该按钮，或者如果用户知道自己在做什么并且有动力这样做，也可以手动调用 API 端点。

话虽如此，隐藏按钮应该足以阻止 99.9% 的用户，除非您的受众具有技术背景或有很大的动力尝试重新解锁该类别中的点赞。

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [2022年四月8日 21:07 UTC](https://meta.discourse.org/t/limiting-likes-in-a-specific-category/223697/12 "2022-04-08T21:07:34Z")

</div>

> [@saquetim](#):
>
> 足以阻止 99.9% 的用户

而剩下的 0.1% 会立即被抓住，因为点赞会显示在帖子下方。

---

<div class="post-metadata">

### Author: ![Shirly\_Nowak](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/shirly_nowak/32/571731_2.png) [@Shirly\_Nowak](https://meta.discourse.org/u/Shirly_Nowak)
#### Post date: [2022年四月11日 06:36 UTC](https://meta.discourse.org/t/limiting-likes-in-a-specific-category/223697/13 "2022-04-11T06:36:45Z")

</div>

> [@RGJ](#):
>
> 而剩余的 0.1% 会因为点赞会显示在帖子下方而立即被发现。

是的，就是这个意思。由于这是一群我们比较熟悉的用户（他们是学生），所以很容易“抓住”任何试图欺骗的人。

> [@Jagster](#):
>
> 但这会阻止在某些类别中永久点赞，而不是限制。当然，如果你得到了你想要的东西，那确实是完美的解决方案。

是的，在我们的情况下就是这样 🙂

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2022年五月11日 06:37 UTC](https://meta.discourse.org/t/limiting-likes-in-a-specific-category/223697/14 "2022-05-11T06:37:26Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
