# 是否可以检测用户是否已登录？

**URL:** https://meta.discourse.org/t/possible-to-detect-if-user-is-logged-in/254557
**Category:** Development
**Created:** [2023年二月9日 02:14 UTC](https://meta.discourse.org/t/possible-to-detect-if-user-is-logged-in/254557 "2023-02-09T02:14:03Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![stromfeldt](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stromfeldt/32/223364_2.png) [@stromfeldt](https://meta.discourse.org/u/stromfeldt)
#### Post date: [2023年二月9日 02:14 UTC](https://meta.discourse.org/t/possible-to-detect-if-user-is-logged-in/254557/1 "2023-02-09T02:14:03Z")

</div>

搜索后似乎不可能，但我还是问一下。

我目前正在与某人完成一项集成，以便 Ghost 可以用作 Discourse 的 SSO 提供商，将两个会员系统连接在一起。我已经将 Ghost 的页脚复制到了 Discourse 中，在 Ghost 中，可以通过使用类似以下内容来根据用户是否登录来更改它：

```plaintext
{{#if @member}}
欢迎回来！
{{else}}
加入
{{/if}}

```

在 Discourse 的“自定义” → “主题” → “编辑 CSS/HTML” → “页脚”部分中，是否可以实现类似的功能？

---

<div class="post-metadata">

### Author: ![Lhc\_fl](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lhc_fl/32/268115_2.png) [@Lhc\_fl](https://meta.discourse.org/u/Lhc_fl)
#### Post date: [2023年二月9日 07:23 UTC](https://meta.discourse.org/t/possible-to-detect-if-user-is-logged-in/254557/2 "2023-02-09T07:23:37Z")

</div>

根据我开发主题组件的经验，这是可能的，但也许你需要提供一个插件插槽？

---

<div class="post-metadata">

### Author: ![Heliosurge](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/heliosurge/32/571810_2.png) [@Heliosurge](https://meta.discourse.org/u/Heliosurge)
#### Post date: [2023年二月10日 01:20 UTC](https://meta.discourse.org/t/possible-to-detect-if-user-is-logged-in/254557/3 "2023-02-10T01:20:30Z")

</div>

应该可以实现，因为有一个名为 Who’s Online 的 #customization:plugin。
