Given the surprising level of difficulty, maybe we should just leave this be… not like it is broken the way it is.
I know it’s late but I just want to share my solution to display that admin crown ( so far only on topic’s page ) by using CSS and JS. I could also use some help cause for some reason my js code is not working…I can see it in that inline theme js file but still not working ( works well on jsfiddle though )

CSS
.names span.admin a::after {
content: "";
width: 17px;
height: 14px;
margin-left: 5px;
background-image: url(https://www.dropbox.com/s/0oi0y3ex3rtfvk5/cd-crown.svg?raw=1);
background-repeat: none;
display: inline-block;
position: relative;
}
JS ( to display the title on hover - but as I said is not working when I include it inside )
Working Jsfiddle demo
var cdcrowntitle = document.querySelector(".names .admin a");
cdcrowntitle.setAttribute("title", "Community Admin");
我们的一位版主也收到了同样的反馈。过去两年里,在区分管理员/版主图标方面有什么进展/想法吗?
我在这个话题中没有看到,但我在论坛上使用 CSS 来为帖子中的版主和管理员(如果管理员是版主组成员)制作不同颜色的盾牌。在我的例子中,版主获得金色盾牌,管理员获得灰色盾牌。但当然,可以在这些颜色属性中使用任何颜色。
通用 CSS
// * 更改帖子中区分管理员和版主用户的盾牌颜色* //
span.username {
&.moderator .d-icon.d-icon-shield-alt {
color: #d5b907;
}
&.admin .d-icon.d-icon-shield-alt {
color: #969696;
}
}
我还没有费心为用户卡片或个人资料做这件事,但我想我应该能弄清楚。
您还可以更改帖子中版主和管理员用户名的颜色,以进一步区分他们:
// * 更改区分管理员和版主的用户名颜色* //
span.username {
&.moderator a {
color: #d5b907;
}
&.admin a {
color: #969696;
}
}
盾牌颜色更改无效-两者看起来仍然是相同的灰色。选择器是否自发布以来发生了变化?
也许可以。快速检查一下页面就能帮你确定类名。
图标现在命名为 d-icon-shield-halved。
是的,图标名称已更改,应如下所示
span.username {
&.moderator .d-icon.d-icon-shield-halved {
color: #d5b907;
}
&.admin .d-icon.d-icon-shield-halved {
color: #969696;
}
}
结果
谢谢莉莉!还有……CocoQuark,不管你怎么拼写。
只是想知道我们是否想用巫师帽替换管理员图标,交换颜色和显示无,然后添加一行 .d-icon.d-icon-wizard? (不确定巫师帽的 fa)
fa 是:
fa-solid fa-hat-wizard
那么 CSS 会是什么样的,如果我想将管理员图标更改为 hat-wizard?
同样的 CSS。
如果你使用这种替换方法,类名仍然是 d-icon-shield-halved,无论你替换了哪个图标:
最简单的做法是使用 与上面相同的代码,但也在 head-tag 标签中加入类似这样的图标替换代码:
在
<script type="text/discourse-plugin" version="0.8">
api.replaceIcon('shield-halved', 'hat-wizard')
</script>
结果:
这样管理员就能戴帽子,版主就能戴盾牌,对吗?还是说它会像图片中那样替换掉所有东西,如果是这样的话,有什么办法可以解决吗?
也许你可以修改条件 CSS 或在脚本中添加一些代码。但这会替换所有图标。
实际上,就连向导图标现在也无法正常工作。我使用了您在头部给我的确切代码。
我可以再试一次,也许只是一个故障之类的。
这是一个OT问题,但我希望为版主保留半盾。但我非常希望在管理员头上显示巫师帽 [1]
但由于版主的原因,我不能用帽子替换半盾。
天哪……
我真的应该开始阅读帖子了🤦♂️ 对不起。
我的论坛里有几个中年女性,她们是哈利·波特迷;这会让她们非常恼火😂 ↩︎
在我的论坛上,它只显示在用户卡片和个人资料上,而不是在主题上。
有什么想法是我又做错了什么吗?
修订代码的 Shield svg。



