您好,我知道 Discourse 不会像以前那样强调用户的发帖数,而是更注重阅读时间。但对于我迁移过来的传统论坛用户来说,发帖数是一个重要的指标。如果能在用户卡片弹出时就显示总发帖数(主题数 + 回复数),而不是需要进入用户摘要页面才能看到,那就太好了。
我尝试使用这个作为模型,它确实可以显示用户的“上次看到”时间:
https://github.com/tshenry/discourse-last-seen-user-card-theme-component/blob/main/common/head_tag.html
但我的版本不起作用(我最初只是想显示回复数):
尝试 1:
<script type="text/x-handlebars" data-template-name="/connectors/user-card-metadata/post-count-metadata">
{{#if user.summary.post_count}}
<h3><span class='desc'>Count:</span> {{user.summary.post_count}}</h3>
{{/if}}
</script>
尝试 2:
<script type="text/x-handlebars" data-template-name="/connectors/user-card-metadata/post-count-metadata">
{{#if user.post_count}}
<h3><span class='desc'>Count:</span> {{user.post_count}}</h3>
{{/if}}
</script>
尝试 3:
<script type="text/x-handlebars" data-template-name="/connectors/user-card-metadata/post-count-metadata">
{{#if user.stats.post_count}}
<h3><span class='desc'>Count:</span> {{user.stats.post_count}}</h3>
{{/if}}
</script>
看起来用户统计模型没有在该 handlebars 位置加载,我不知道如何访问它。我找到了这个:
还有这个:
我是否需要创建一个 discourse-plugin 脚本来访问它,然后使用 api.createWidget 创建一个 HTML 小部件?或者有没有更简单的方法只使用 handlebars?