# 在帖子中显示个人资料标题

**URL:** https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917
**Category:** Development
**Created:** [2023年三月13日 07:29 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917 "2023-03-13T07:29:25Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![Kushalghosh9899](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kushalghosh9899/32/292844_2.png) [@Kushalghosh9899](https://meta.discourse.org/u/Kushalghosh9899)
#### Post date: [2023年三月13日 07:29 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/1 "2023-03-13T07:29:25Z")

</div>

我想在全名下方添加“个人简介”字段，我尝试寻找方法但没有找到。

 ![image](https://global.discourse-cdn.com/meta/original/4X/7/5/2/75201f9114a55e91188f3d167c7571ac019aadf1.png)

除此之外，还有一个错误/问题，即我在帖子中将 `enable_name` 设置为 `true`，并通过在“自定义”\>“主题”\>“编辑 CSS/HTML”中添加一些 CSS 规则来隐藏帖子中的用户名。

```plaintext
//Hides the username from the Post page
.names .username {
    display: none!important;
}

```

这些设置以前运行良好，但现在全名也对某些用户隐藏了。

 ![image](https://global.discourse-cdn.com/meta/original/4X/a/9/5/a951f071ec803d9d30d114423696ef004dc1c762.png)

请帮助我修复这些设置。

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2023年三月13日 09:56 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/2 "2023-03-13T09:56:06Z")

</div>

嗨 Kushal 🙂  
你能否澄清一下你说的“个人资料标题字段”是什么意思？

至于隐藏用户名，根据你网站的设置，你可以尝试以下方法：

```css
.names .second.username {
    display: none;
}

```

---

<div class="post-metadata">

### Author: ![Kushalghosh9899](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kushalghosh9899/32/292844_2.png) [@Kushalghosh9899](https://meta.discourse.org/u/Kushalghosh9899)
#### Post date: [2023年三月13日 10:01 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/3 "2023-03-13T10:01:29Z")

</div>

上面的 CSS 代码没有隐藏用户的用户名。

我说的是这个标题

 ![image](https://global.discourse-cdn.com/meta/original/4X/9/d/e/9de852034e1d95c242fbfee35fb223c84eb7dfe3.png)

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2023年三月13日 10:37 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/4 "2023-03-13T10:37:34Z")

</div>

> [@Kushalghosh9899](#):
>
> 上面的 CSS 代码没有隐藏用户的用户名。

因此，我的“取决于您网站的设置”，但这应该由我来处理，我应该从默认设置开始，使用以下 CSS 应该可以工作：

```css
.names .first.username {
    display: none;
}

```

至于全名下方的标题，请尝试这个：

```scss
.topic-meta-data .names {
    flex-wrap: wrap;
    .user-title {
        width: 100%;
    }
}

```

![image](https://global.discourse-cdn.com/meta/original/4X/9/3/2/932a51824867e990585c8ce73d2bd86660b56170.png)

请注意，可能会产生意想不到的副作用（正如在对包含多个子元素的元素进行 CSS 更改时经常发生的那样）。

---

<div class="post-metadata">

### Author: ![Kushalghosh9899](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kushalghosh9899/32/292844_2.png) [@Kushalghosh9899](https://meta.discourse.org/u/Kushalghosh9899)
#### Post date: [2023年三月13日 11:18 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/5 "2023-03-13T11:18:29Z")

</div>

CSS 设置工作正常，但我觉得问题有所不同，因为有些用户的用户名和全名在帖子类别中都可见，而有些用户只可见用户名（通过页面源代码检查，仅从数据库中获取用户名）。  
除此之外，个人资料标题 CSS 代码是完美的，但如何从数据库中获取详细信息，因为它没有从数据库中获取，所以没有显示它的问题。  
恳请帮助我解决这个问题。

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2023年三月13日 11:29 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/6 "2023-03-13T11:29:14Z")

</div>

我对这个 CSS 有点太快了，没有检查没有全名的帐户，所以我的 CSS 建议有问题。

您能否提供您网站的以下设置值？

- **需要全名**

- **在用户体验中优先显示用户名**

---

<div class="post-metadata">

### Author: ![Kushalghosh9899](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kushalghosh9899/32/292844_2.png) [@Kushalghosh9899](https://meta.discourse.org/u/Kushalghosh9899)
#### Post date: [2023年三月13日 11:30 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/7 "2023-03-13T11:30:32Z")

</div>

全名字段自启动以来一直是必填字段，对于第二点我需要更详细的说明。

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2023年三月13日 11:33 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/8 "2023-03-13T11:33:13Z")

</div>

> [@Kushalghosh9899](#):
>
> 对于第二个要点，我需要更多的澄清。

是这个设置：

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/f/a/dfa731b3350a78b91c6de940310efd32a4856748.png)

🙂

---

<div class="post-metadata">

### Author: ![Kushalghosh9899](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kushalghosh9899/32/292844_2.png) [@Kushalghosh9899](https://meta.discourse.org/u/Kushalghosh9899)
#### Post date: [2023年三月13日 11:34 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/9 "2023-03-13T11:34:30Z")

</div>

为了更清楚地说明，所有账户都有全名和用户名（通过访问他们的个人资料进行验证）。只是在帖子页面上，一些账户的全名未能获取。

如何在全名后添加个人资料标题？

---

<div class="post-metadata">

### Author: ![Kushalghosh9899](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kushalghosh9899/32/292844_2.png) [@Kushalghosh9899](https://meta.discourse.org/u/Kushalghosh9899)
#### Post date: [2023年三月13日 11:35 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/10 "2023-03-13T11:35:36Z")

</div>

是的，此设置已启用

---

<div class="post-metadata">

### Author: ![Kushalghosh9899](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kushalghosh9899/32/292844_2.png) [@Kushalghosh9899](https://meta.discourse.org/u/Kushalghosh9899)
#### Post date: [2023年三月13日 11:37 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/11 "2023-03-13T11:37:08Z")

</div>

两个设置都已启用  
 ![image](https://cdck-file-uploads-global.s3.dualstack.us-west-2.amazonaws.com/meta/original/4X/9/3/8/9385e49d4502e951e3ce38ecae1db2f8541c55c5.png)

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2023年三月13日 13:24 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/12 "2023-03-13T13:24:02Z")

</div>

谢谢你的信息 🙂

如果你启用了 **在用户体验中优先显示用户名** ，那么当用户的用户名和全名相同时，用户名将显示在每篇帖子中。  
而且，如果你只想用 CSS 来隐藏用户名，你将无法做到，因为你无法定位前面的元素。

例如，你会有两篇帖子显示：

1. 用户名

2. 用户名 全名

你将无法只隐藏那些全名与用户名不同的用户的用户名，因为用户名显示在全名 **之前** 。

这有点复杂，难以解释 😅

所以，如果你想要一个纯 CSS 的解决方案，你需要禁用 **在用户体验中优先显示用户名** 并使用以下 CSS：

```scss
.names {
    .full-name +.username {
        display: none;
    }
}

```

至于名字下方的头衔，你可以使用这个更新后的 CSS：

```scss
.topic-meta-data .names {
    flex-wrap: wrap;
    .user-title {
        width: 100%;
        order: 1;
    }
}

```

`order: 1;` 可以防止用户的状态表情符号出现在头衔旁边，并将其保留在全名旁边：

如果我将所有这些 CSS 结合起来，结果如下。

之前：

 ![image](https://global.discourse-cdn.com/meta/original/4X/8/1/f/81fe23920c378fad71f87d5e446956ee20753664.png)

```css
.topic-meta-data .names {
    flex-wrap: wrap;
    .full-name +.username {
        display: none;
    }
    .user-title {
        width: 100%;
        order: 1;
    }
}

```

之后：

 ![image](https://global.discourse-cdn.com/meta/original/4X/2/8/6/28600a847d76497603d7f24a31dcbc7e3b283bf7.png)

---

<div class="post-metadata">

### Author: ![Kushalghosh9899](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kushalghosh9899/32/292844_2.png) [@Kushalghosh9899](https://meta.discourse.org/u/Kushalghosh9899)
#### Post date: [2023年三月14日 04:03 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/13 "2023-03-14T04:03:44Z")

</div>

感谢您的努力，但这段代码仍然无法正常工作，即使我在 CSS 中添加了 `!important`，它仍然不起作用。  
至于个人简介标题，它没有从后端加载，请参阅下面的截图作为参考

 ![image](https://global.discourse-cdn.com/meta/original/4X/8/d/9/8d9c7c534c1607e80792839704a09dfe648c583d.png)

---

<div class="post-metadata">

### Author: ![Kushalghosh9899](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kushalghosh9899/32/292844_2.png) [@Kushalghosh9899](https://meta.discourse.org/u/Kushalghosh9899)
#### Post date: [2023年三月14日 09:43 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/14 "2023-03-14T09:43:26Z")

</div>

[此](https://meta.discourse.org/t/remove-name-suppression-on-posts/86265)插件帮助我解决了当用户名和全名相同时，其中一个被自动隐藏的问题。

请帮我将 **个人资料标题** 添加到全名之后。

---

<div class="post-metadata">

### Author: ![Kushalghosh9899](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kushalghosh9899/32/292844_2.png) [@Kushalghosh9899](https://meta.discourse.org/u/Kushalghosh9899)
#### Post date: [2023年四月3日 11:51 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/15 "2023-04-03T11:51:05Z")

</div>

有人能帮我看看如何让个人资料标题在帖子页面上可见吗？

---

<div class="post-metadata">

### Author: ![Kushalghosh9899](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kushalghosh9899/32/292844_2.png) [@Kushalghosh9899](https://meta.discourse.org/u/Kushalghosh9899)
#### Post date: [2023年四月11日 08:29 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/16 "2023-04-11T08:29:11Z")

</div>

@JammyDodger 我该怎么办？是应该发新帖还是有其他方法可以解决这个问题？

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2023年四月11日 16:26 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/17 "2023-04-11T16:26:00Z")

</div>

您能分享一下你们论坛的链接吗？

---

<div class="post-metadata">

### Author: ![Kushalghosh9899](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kushalghosh9899/32/292844_2.png) [@Kushalghosh9899](https://meta.discourse.org/u/Kushalghosh9899)
#### Post date: [2023年四月12日 11:44 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/18 "2023-04-12T11:44:58Z")

</div>

论坛链接如下 -  
[https://team.krsh.org](https://team.krsh.org)

---

<div class="post-metadata">

### Author: ![Canapin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/canapin/32/119591_2.png) [@Canapin](https://meta.discourse.org/u/Canapin)
#### Post date: [2023年四月12日 12:39 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/19 "2023-04-12T12:39:31Z")

</div>

谢谢。 🙂

请尽可能精确，因为您的请求有点令人困惑。

> [@Kushalghosh9899](#):
>
> 请帮我把 **个人简介** 加在全名后面

您说的“后面”是指“下面”吗？

* * *

您的注册表单包含一个“个人简介”字段，但我怀疑这与您的问题无关。据我理解，您要求在用户名下方显示用户的 **头衔** 。

我在您的论坛上尝试了我[消息](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/12?u=canapin)中的代码，它奏效了：

之前：  
 ![image](https://global.discourse-cdn.com/meta/original/4X/9/c/3/9c32a9e934f9e0daf5e137fcf3ccae538b95c1ba.png)

之后：  
 ![image](https://global.discourse-cdn.com/meta/original/4X/8/d/0/8d097a6807d1e28eb285f89cdf62f7c55b6c3824.png)

这就是您想要的吗？

---

<div class="post-metadata">

### Author: ![Kushalghosh9899](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kushalghosh9899/32/292844_2.png) [@Kushalghosh9899](https://meta.discourse.org/u/Kushalghosh9899)
#### Post date: [2023年四月17日 04:07 UTC](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917/20 "2023-04-17T04:07:32Z")

</div>

我之前已经提到过，我想要 **显示个人简介标题** ，如果这个标题能显示在全名下方就太棒了，就像您在第二张图片中发送的那样，应该显示“Internship Secured”个人简介标题的位置。

> [@Canapin](#):
>
> 之后

 ![image](https://global.discourse-cdn.com/meta/original/4X/4/1/3/413d4a4d596f05ff05b0fc8aeef701497733b004.png)

[下一頁](https://meta.discourse.org/t/show-profile-headline-in-the-posts/257917.md?page=2)
