# Discourse Show Fullname in Mentions

**URL:** https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319
**Category:** Theme component
**Created:** [January 28, 2022, 2:51pm UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319 "2022-01-28T14:51:12Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![saquetim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saquetim/32/116400_2.png) [@saquetim](https://meta.discourse.org/u/saquetim)
#### Post date: [January 28, 2022, 2:51pm UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/1 "2022-01-28T14:51:12Z")

</div>

| | | |
| --- | --- | --- |
| 👓 | **Preview** | [https://theme-creator.discourse.org/theme/megothss/discourse-show-name-mentions](https://theme-creator.discourse.org/theme/megothss/discourse-show-name-mentions) |
| 🛠 | **Repository** | [GitHub - megothss/discourse-show-name-mentions: A discourse theme component to display the full name instead of usernames in @mentions · GitHub](https://github.com/megothss/discourse-show-name-mentions) |
| ❓ | **Install Guide** | [How to install a theme or theme component](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682) |
| 📖 | **New to Discourse Themes?** | [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) |

Install this theme component

A theme component to display the full name instead of usernames in `@mentions`.

This theme component loads the full name of the user and display `@fullname` instead of `@username` in mentions.

- before:  

- after:  

This component works by simply replacing the username with the name of the user (if available) when displaying the posts. Nothing changes while editing. You still tag `@username` like always in the composer.

It also adds the class `.mention-fullname` to the `a.mention` anchor element if you wish the style full name mentions in a distinct way.

Displaying the card when clicking in the `@fullname` mentions remains fully functional.

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

# Use case:

Imagine a Discourse instance where every username name follows the pattern X9999999 (one letter and seven numbers). Now imagine there are 100k users registered.

Not very friendly, right? Unfortunately, this is a very real scenario and not an imaginary one. The Discourse instance is bonded to SSO and all usernames follow corporate policy.

It’s much better in this case to read `@John Doe` instead of `@X9999999`.

# Settings:

- **show\_fullname\_in\_mentions** : If enabled @mentions will show the @fullname instead of the @username

---

<div class="post-metadata">

### Author: ![ImaCrea](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/imacrea/32/275402_2.png) [@ImaCrea](https://meta.discourse.org/u/ImaCrea)
#### Post date: [December 16, 2022, 3:50pm UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/3 "2022-12-16T15:50:14Z")

</div>

Hello Sérgio, thanks for the theme component!

I tried it but after experimenting I see it create some inconsistency UX-wise.

Here’s what happens : I got this user whom username is “oli44” and fullname “Henri Oliver”. With your theme component it now displays “Henri Oliver” which is great adds better context. But then, let’s say then I’m another user who doesn’t know that “Henri Oliver” goes by the username “oli44” then how do I mention him in my post?

I’m gonna search for “Henri Oliver” and I will see in deed “oli44” but how can I know it’s the actual person?

For that reason, as it is I’m finally not enabling it for the moment. Do you know eventually another theme component/plugin which would solve that problem? I tried to look for such but couldn’t find.

Or maybe there’s a way your theme component could still show the username (for ex: `@Henri Oliver (oli44)`) so when I need to mention that person I know what to look for(?)

Thanks anyway for this great addition

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [September 9, 2023, 6:14am UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/4 "2023-09-09T06:14:25Z")

</div>

> [@ImaCrea](#):
>
> Here’s what happens : I got this user whom username is “oli44” and fullname “Henri Oliver”. With your plugin it now displays “Henri Oliver” which is great adds better context. But then, let’s say then I’m another user who doesn’t know that “Henri Oliver” goes by the username “oli44” then how do I mention him in my post?

You just type `@` followed by `Henri Oliver`. After confirming, @+username will be inserted into your post.

When searching, both the username and the full name are displayed.  
Where is the problem?

> [@ImaCrea](#):
>
> Or maybe there’s a way your theme component could still show the username (for ex: `@Henri Oliver (oli44)`) so when I need to mention that person I know what to look for(?)

You can customize the rendering in a fork easily:

[https://github.com/thoka/discourse-show-name-mentions/commit/003b64369c196f71fb76d4e6d8f81f46f4cc2672](https://github.com/thoka/discourse-show-name-mentions/commit/003b64369c196f71fb76d4e6d8f81f46f4cc2672)

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [September 9, 2023, 6:21am UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/5 "2023-09-09T06:21:30Z")

</div>

I see two issues:

There will be one ajax request per mention to the server.  
Could this lead to throttling in pages with a lot of usernames (like user supplied user directories)?

The cached username to full-name translation will not recognize changes in full-name. How long does this cache live?

I wonder if the needed information (username → fullname) could be provided via a companion plugin, which would make these issues obsolete.

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [October 1, 2023, 12:21pm UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/6 "2023-10-01T12:21:44Z")

</div>

Since we were experiencing the expected problems, I created a plugin that provides the full names along with the mentions:

[https://github.com/thoka/discourse-provide-full-name-in-mentions](https://github.com/thoka/discourse-provide-full-name-in-mentions)

Accordingly, the ajax request was removed from the component.

I also added an option to configure the template used for rendering  
mentions:

[https://github.com/thoka/discourse-show-name-mentions](https://github.com/thoka/discourse-show-name-mentions)

---

<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: [October 2, 2023, 10:04am UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/7 "2023-10-02T10:04:58Z")

</div>

Were ajax requests mandatory if we wanted to stick to a theme component?

If this is the case, I invite you to create a new #Customization > Plugin topic, if you consider your work reliable enough to be used by others 🙂

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [October 2, 2023, 11:02am UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/8 "2023-10-02T11:02:52Z")

</div>

I’m not allowed to write in that category …

> [@Canapin](#):
>
> Were ajax requests mandatory if we wanted to stick to a theme component?

I don’t know. Since I’m only digging into plugin / component development, I’ve chosen to collect these two hacks, to get the desired behavior.

But maybe others like to join in to polish it.

---

<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: [October 2, 2023, 11:24am UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/10 "2023-10-02T11:24:43Z")

</div>

> [@thoka](#):
>
> I’m not allowed to write in that category …

You have to request access on the group page 🙂

[https://meta.discourse.org/g/plugin\_authors](https://meta.discourse.org/g/plugin_authors)

---

<div class="post-metadata">

### Author: ![Hifihedgehog](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hifihedgehog/32/140207_2.png) [@Hifihedgehog](https://meta.discourse.org/u/Hifihedgehog)
#### Post date: [October 2, 2023, 5:25pm UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/12 "2023-10-02T17:25:31Z")

</div>

You just posted this and I just installed the original author’s plugin right as you posted. The thing is, I noticed that the original author’s plugin does not support full names for group. However, it looks like you added groups. If so, congratulations! Your plugin deserves its own thread given what you’ve enabled!

---

<div class="post-metadata">

### Author: ![Hifihedgehog](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hifihedgehog/32/140207_2.png) [@Hifihedgehog](https://meta.discourse.org/u/Hifihedgehog)
#### Post date: [October 2, 2023, 5:51pm UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/13 "2023-10-02T17:51:07Z")

</div>

Maybe I’m not doing something right, but I enabled your theme component and plugin and I’m no longer seeing the full name in mentions.

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [October 2, 2023, 7:13pm UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/14 "2023-10-02T19:13:38Z")

</div>

Did you rebake your posts?

---

<div class="post-metadata">

### Author: ![Hifihedgehog](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hifihedgehog/32/140207_2.png) [@Hifihedgehog](https://meta.discourse.org/u/Hifihedgehog)
#### Post date: [October 2, 2023, 8:06pm UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/15 "2023-10-02T20:06:37Z")

</div>

Thanks! Now I did. Would searching groups also be possible? I have my trust\_level\_0 group named as everyone. If the plugin could also use the full name for the group mentions, this would be a cool way to make global trust\_level\_0 mentions look like an everyone mention.

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [October 2, 2023, 9:16pm UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/16 "2023-10-02T21:16:31Z")

</div>

> [@Hifihedgehog](#):
>
> If the plugin could also use the full name for the group mentions

It does now (you have to update the component also).

Unfortunately, the group name link will not open the group when clicked.

---

<div class="post-metadata">

### Author: ![saquetim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saquetim/32/116400_2.png) [@saquetim](https://meta.discourse.org/u/saquetim)
#### Post date: [October 2, 2023, 9:31pm UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/17 "2023-10-02T21:31:57Z")

</div>

> [@thoka](#):
>
> Did you rebake your posts?

Since the plugin includes the info while baking the posts. Be aware that if the user updates the full name, it won’t be updated in the post unless the post is rebaked.

I need to update a few things in this theme-component. Removing the Ajax calls is now possible if the user status is enabled.

Will try to do it soon.

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [October 2, 2023, 9:39pm UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/18 "2023-10-02T21:39:40Z")

</div>

> [@saquetim](#):
>
> Be aware that if the user updates the full name, it won’t be updated in the post unless the post is rebaked.

Exactly. It should watch user and group name changes:

> [@Discourse Provide Full Name in Mentions](https://meta.discourse.org/t/discourse-provide-full-name-in-mentions/280813/1):
>
> Watch for user and group name changes and rebake affected posts.

---

<div class="post-metadata">

### Author: ![saquetim](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/saquetim/32/116400_2.png) [@saquetim](https://meta.discourse.org/u/saquetim)
#### Post date: [October 2, 2023, 9:45pm UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/19 "2023-10-02T21:45:18Z")

</div>

> [@Discourse Provide Full Name in Mentions](https://meta.discourse.org/t/discourse-provide-full-name-in-mentions/280813/1):
>
> Watch for user and group name changes and rebake affected posts.

Rebaking is expensive. This can be problematic in some communities, depending on how frequently the users change their names.

Keep this in mind.

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [October 2, 2023, 9:50pm UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/20 "2023-10-02T21:50:58Z")

</div>

Thanks. In our more formal school community the names will not change frequently.

In principle, the names could be added while shipping already baked content. It seems, you would prefer this path?

---

<div class="post-metadata">

### Author: ![Hifihedgehog](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hifihedgehog/32/140207_2.png) [@Hifihedgehog](https://meta.discourse.org/u/Hifihedgehog)
#### Post date: [October 2, 2023, 10:44pm UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/21 "2023-10-02T22:44:20Z")

</div>

It works mostly. I am not sure why but even though I have trust level 0 renamed to everyone, it doesn’t apply the label to it.

 ![image](https://global.discourse-cdn.com/meta/original/4X/2/c/3/2c31809b4c150b400e20566910e19e372a959420.png)  
 ![image](https://global.discourse-cdn.com/meta/original/4X/f/4/2/f428514358c158ce46a6b1b1f57aa45b36ba643d.png)

Non trust-level groups all work though and display their full names.

 ![image](https://global.discourse-cdn.com/meta/original/4X/1/0/f/10ffb6d4e2e75f1bb8ad5c45157a870004d10cd0.png)

EDIT: Ah, because the _full\_name_ column in the _groups_ table does not hold the modified full name value of trust level groups! Checking [data explorer](https://meta.discourse.org/t/32566?silent=true), it is null. Hmm?

---

<div class="post-metadata">

### Author: ![thoka](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thoka/32/115652_2.png) [@thoka](https://meta.discourse.org/u/thoka)
#### Post date: [October 3, 2023, 6:07am UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/22 "2023-10-03T06:07:40Z")

</div>

> [@Hifihedgehog](#):
>
> Checking [data explorer](https://meta.discourse.org/t/32566), it is null. Hmm?

From the above picture, it seems that you changed i18n entries for trust\_level\_0.

Try `Group.find(10).update! full_name: "TESTTEST"` in rails console.

This might have side effects, considering changing full names of built-in groups is not allowed in the UI.

---

<div class="post-metadata">

### Author: ![Hifihedgehog](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hifihedgehog/32/140207_2.png) [@Hifihedgehog](https://meta.discourse.org/u/Hifihedgehog)
#### Post date: [October 10, 2023, 4:53pm UTC](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319/23 "2023-10-10T16:53:40Z")

</div>

Indeed. I tried this, and it worked without any serious impact. Is there a way to incorporate groups without having to use the plugin and only using the theme component? That’s actually preferred for me since I don’t relish raking if I can avoid it.

[Next page](https://meta.discourse.org/t/discourse-show-fullname-in-mentions/216319.md?page=2)
