您好!看起来我们之前设置在登录按钮旁边的注册按钮不再显示了,并且我在控制台中看到一个错误:“[THEME NAME] decorateWidget: Could not find widget ‘header-buttons’ in registry”。
据我所知,直到现在添加此按钮的方式是通过“自定义”->“主题”并使用类似以下的脚本:
<script type="text/discourse-plugin" version='0.8.12'>
api.decorateWidget('header-buttons:after', function (helper) {
if (!api.getCurrentUser()) {
return helper.attach('link', {
href: 'https://www.bassbuzz.com/account/signup',
rawLabel: 'Sign Up',
className: "btn btn-primary btn-small login-button"
});
}
});
</script>
我阅读了一些类似的主题,例如 https://meta.discourse.org/t/add-button-in-header-for-logged-in-users/276704/3,但我总是收到“header-icons”在注册表中未找到的错误。
我也尝试过以下方法,结果相同:
<script type="text/discourse-plugin" version='0.8.12'>
api.decorateWidget('header-buttons:after', helper => {
if (!api.getCurrentUser()) {
return helper.h('li', [
helper.h('a.btn.btn-primary.btn-small.login-button', {
href: 'https://www.bassbuzz.com/account/signup'
}, 'Sign Up')
]);
}
});
</script>
我还查看了这里的文档:https://meta.discourse.org/t/beginners-guide-to-developing-discourse-themes/93648,但我似乎无法弄清楚我缺少什么。
是否有任何设置可能阻止上述代码正常工作?它以前是有效的,我不确定是什么时候停止工作的。有人有什么建议吗?提前感谢!