# 用户可以在其个人资料上显示其 User ID 吗？

**URL:** <https://meta.discourse.org/t/can-users-make-their-user-id-visible-on-their-profile/394001>\
**Category:** Development\
**Created:** [2026年一月21日 16:20 UTC](https://meta.discourse.org/t/can-users-make-their-user-id-visible-on-their-profile/394001 "2026-01-21T16:20:21Z")\
**Posts on this page:** 1\
**Showing post:** 13

<div class="post-metadata">

**Author:** ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)\
**Post date:** [2026年一月23日 16:48 UTC](https://meta.discourse.org/t/can-users-make-their-user-id-visible-on-their-profile/394001/13 "2026-01-23T16:48:23Z")

</div>

我认为，如果您选择一个提供您正在查看的用户的模型的插口会更容易。  
您选择的插口提供有关主题的信息，但不是有关用户的信息

> [@1vernit3](#):
>
> 我只是将用户 ID 放在插件插口中： **header-contents\_\_after**

> <https://github.com/discourse/discourse/blob/6bcffe2b06ac66e41f965c58b1cad180805db33d/frontend/discourse/app/components/header/contents.gjs#L147-L152>

  
用户个人资料上的插口，如 `user-post-names`，提供用户模型： https://github.com/discourse/discourse/blob/5b6d32804a1eb658fdc043b082336a17b4c1c944/frontend/discourse/app/templates/user.gjs#L220-L224 使用提供模型的插口，您应该能够像教程中的示例一样使用 `@outletArgs`：https://meta.discourse.org/t/theme-developer-tutorial-4-using-outlets-to-insert-and-replace-content/357799。那里的示例使用 `discovery-list-container-top`，它提供 `@outletArgs={{lazyHash category=@model.category tag=@model.tag}}`

> [@system](#):
>
> ```plaintext
> api.renderInOutlet(
> "discovery-list-container-top",
> <template>
> <div class="custom-welcome-banner">
> ...
> You're viewing
> {{#if @outletArgs.category}}
> "{{@outletArgs.category.name}}" topics.
> {{else}}
> all topics.
> {{/if}}
> </div>
> </template>
> );
> 
> ```

这就是为什么我选择一个提供用户模型的插口。当您将鼠标悬停在插口上并看到您正在查看的用户的 ID 时，您可以看到模型。教程中的许多示例都使用 `currentUser` 服务，它提供当前用户的 ID，这似乎不是您要找的。

 ![image](https://global.discourse-cdn.com/meta/original/4X/a/e/6/ae65dba274814a8b879d213610b6296ef6ee2dd3.png)

---

_[View the full topic](https://meta.discourse.org/t/can-users-make-their-user-id-visible-on-their-profile/394001)._
