# 在用户卡片上显示社交登录资料

**URL:** <https://meta.discourse.org/t/show-social-login-profiles-on-user-card/179490>\
**Category:** Support\
**Created:** [2021年二月12日 18:24 UTC](https://meta.discourse.org/t/show-social-login-profiles-on-user-card/179490 "2021-02-12T18:24:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cookieman768](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cookieman768/32/118511_2.png) [@cookieman768](https://meta.discourse.org/u/cookieman768)\
**Post date:** [2021年二月12日 18:24 UTC](https://meta.discourse.org/t/show-social-login-profiles-on-user-card/179490/1 "2021-02-12T18:24:51Z")

</div>

大家好，我还在熟悉 Discourse，想请教一下如何在用户资料卡上显示关联的账户。我主要希望展示 Steam 个人资料和 Discord 用户名。目前我通过自定义用户字段实现了这一功能，但我更希望有一个自动化的方案，并且能够验证信息的准确性，即确认用户确实拥有其所声称的账户。我具备一定的技术背景，但对修改 Discourse 的了解还比较有限。

编辑：这是我想要的效果：

 ![image](https://global.discourse-cdn.com/meta/original/3X/e/b/eb846340f23359014a1b2ddc8d3906373835a54a.png)

---

<div class="post-metadata">

**Author:** ![ondrej](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ondrej/32/198804_2.png) [@ondrej](https://meta.discourse.org/u/ondrej)\
**Post date:** [2021年二月12日 18:29 UTC](https://meta.discourse.org/t/show-social-login-profiles-on-user-card/179490/2 "2021-02-12T18:29:46Z")

</div>

你好！

这个主题组件够用吗？

> [@Clickable Social Icon Links on Profile](https://meta.discourse.org/t/clickable-social-icon-links-on-profile/158136):
>
> A Theme Component that includes social icons as clickable within User Profile & User Cards if you are using the [User Cards Directory Theme Component](https://meta.discourse.org/t/user-card-directory/144479/29) It’s 99% copied from the discussion & code samples provided by @LeoMcA included in this conversation on [Meta](https://meta.discourse.org/t/link-custom-user-field-to-external-website/41218) and in [Namati User Card Profile Theme](https://github.com/LeoMcA/namati-user-card-profile-theme), but thought it would be helpful to dig it out from the thread and make it slightly more general. Notes Any users that don’t include a value for an entry will…

---

<div class="post-metadata">

**Author:** ![cookieman768](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cookieman768/32/118511_2.png) [@cookieman768](https://meta.discourse.org/u/cookieman768)\
**Post date:** [2021年二月12日 18:32 UTC](https://meta.discourse.org/t/show-social-login-profiles-on-user-card/179490/3 "2021-02-12T18:32:09Z")

</div>

这看起来接近我的需求，至少对 Steam 是可行的。唯一的问题是 Discord 没有个人资料链接，所以需要显示用户名。我可能会尝试一下，看看能否实现接近我想要的效果。我想我可能需要添加一个不可自定义的用户字段，并在用户关联账户时填入相关信息。

编辑：看起来那个方案可能支持 Discord，我得测试一下！非常感谢！

编辑 2：看来那个方案确实可行，但它不会在用户关联社交媒体账户时自动填充这些字段。我的主要顾虑是防止用户冒充他人，所以我希望这些字段在用户使用相应账户登录后就固定下来。我已经联系了该插件的作者，看看他们有什么建议。如果其他人知道更好的方法，我会保持这个帖子开放以便讨论。
