# api.decorateWidget - 如何查找模板名称？

**URL:** <https://meta.discourse.org/t/api-decoratewidget-how-can-i-find-the-templates-names/172907>\
**Category:** Support\
**Created:** [2020年十二月10日 18:09 UTC](https://meta.discourse.org/t/api-decoratewidget-how-can-i-find-the-templates-names/172907 "2020-12-10T18:09:21Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Ed\_Bobkov](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_bobkov/32/200014_2.png) [@Ed\_Bobkov](https://meta.discourse.org/u/Ed_Bobkov)\
**Post date:** [2020年十二月10日 19:29 UTC](https://meta.discourse.org/t/api-decoratewidget-how-can-i-find-the-templates-names/172907/3 "2020-12-10T19:29:42Z")

</div>

感谢提示！我找到了必要的部分 `user-card-post-names:after`。

> **['Plugin Outlet Locations' by @RGJ](https://discourse.theme-creator.io/theme/RGJ/plugin-outlet-locations)**
>
> A customization for Discourse shared on Discourse Theme Creator

我尝试在原始代码中使用它，但失败了。

> [@simon](#):
>
> ```plaintext
> <script type="text/discourse-plugin" version="0.8.27">  
> api.decorateWidget('poster-name:after', helper => {  
> const attrs = helper.attrs;  
> if (attrs.userCustomFields && attrs.userCustomFields.user_field_4) {  
> return helper.h('span.poster-user-field', helper.attrs.userCustomFields.user_field_4);  
> }  
> });  
> </script>  
> 
> ```

我将 `poster-name:after` 改为 `user-card-post-names:after`，但它没有生效，自定义字段在用户卡片上也不可见。对于出现这种情况的原因，有什么建议吗？

---

_[View the full topic](https://meta.discourse.org/t/api-decoratewidget-how-can-i-find-the-templates-names/172907)._
