# How to display user first name as username

**URL:** https://meta.discourse.org/t/how-to-display-user-first-name-as-username/296769
**Category:** Support
**Created:** [February 26, 2024, 4:42pm UTC](https://meta.discourse.org/t/how-to-display-user-first-name-as-username/296769 "2024-02-26T16:42:30Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Celso\_Teixeira](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/celso_teixeira/32/355969_2.png) [@Celso\_Teixeira](https://meta.discourse.org/u/Celso_Teixeira)
#### Post date: [February 26, 2024, 4:42pm UTC](https://meta.discourse.org/t/how-to-display-user-first-name-as-username/296769/1 "2024-02-26T16:42:30Z")

</div>

I prefer the username to consist of the user’s first name rather than their full name. Upon the user’s initial login, I would like the system to automatically set the username using only the first name.  
E.G Full name: **Maria Jose** → username: **Maria**

So instead of the username be _Maria\_Jose_, and want it to be _Maria_

How I can accomplish that?

---

<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: [February 26, 2024, 7:56pm UTC](https://meta.discourse.org/t/how-to-display-user-first-name-as-username/296769/2 "2024-02-26T19:56:17Z")

</div>

Are you looking for the `prioritize username in ux` site setting? This displays the username, which in your example was Maria before displaying Maria Jose.

---

<div class="post-metadata">

### Author: ![Celso\_Teixeira](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/celso_teixeira/32/355969_2.png) [@Celso\_Teixeira](https://meta.discourse.org/u/Celso_Teixeira)
#### Post date: [February 27, 2024, 12:31pm UTC](https://meta.discourse.org/t/how-to-display-user-first-name-as-username/296769/3 "2024-02-27T12:31:16Z")

</div>

The username can be automatically generated using one of three options:

1. Based on Email
2. Based on the user’s full name
3. Random username

I prefer the name to be generated using the second option (Based on the user’s full name), but specifically, I want to utilize only the user’s first name.

To summarize, the username should automatically be selected and consist only of the user’s first name, not the full name.

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [February 27, 2024, 12:54pm UTC](https://meta.discourse.org/t/how-to-display-user-first-name-as-username/296769/4 "2024-02-27T12:54:38Z")

</div>

I don’t know the answer but I’m wondering what would happend when there is several marias or johns? Username must be unique.

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [February 27, 2024, 1:05pm UTC](https://meta.discourse.org/t/how-to-display-user-first-name-as-username/296769/5 "2024-02-27T13:05:09Z")

</div>

Here are the `admin-settings` related to names/ usernames:

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

![image](https://global.discourse-cdn.com/meta/original/4X/1/5/0/1508c3a52801c538b97c41dd36260d8a6752d1ff.png)

![image](https://global.discourse-cdn.com/meta/original/4X/c/2/b/c2b4b2f61ad5b759201520fc73b12d95bade60b1.png)

![image](https://global.discourse-cdn.com/meta/original/4X/5/7/e/57e2de7db015989a435b4d08785957fecc753b1b.png)

![image](https://global.discourse-cdn.com/meta/original/4X/3/7/e/37ec531509f279b8f8fc9894d93c31a82dbdd741.png)

---

<div class="post-metadata">

### Author: ![Celso\_Teixeira](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/celso_teixeira/32/355969_2.png) [@Celso\_Teixeira](https://meta.discourse.org/u/Celso_Teixeira)
#### Post date: [February 27, 2024, 1:37pm UTC](https://meta.discourse.org/t/how-to-display-user-first-name-as-username/296769/6 "2024-02-27T13:37:22Z")

</div>

I’m familiar with the existing configurations, but unfortunately, they don’t address my specific objective. In our discourse system, we employ a Single Sign-On (SSO) mechanism for login, and users don’t have permission to update their usernames. The registration pop-up is also hidden.

Currently, the username is generated from the ‘name’ field, which includes both the first and last names. My goal is to have the username reflect only the user’s first name.

Is this achievable, and are there any plugins or scripts available to facilitate this customization?

---

<div class="post-metadata">

### Author: ![Celso\_Teixeira](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/celso_teixeira/32/355969_2.png) [@Celso\_Teixeira](https://meta.discourse.org/u/Celso_Teixeira)
#### Post date: [February 27, 2024, 2:03pm UTC](https://meta.discourse.org/t/how-to-display-user-first-name-as-username/296769/7 "2024-02-27T14:03:40Z")

</div>

> [@Jagster](#):
>
> I don’t know the answer but I’m wondering what would happend when there is several marias or johns? Username must be unique.

Discourse automatically appends a number to the end of the username. (e.g Maria1, Maria2)

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [February 27, 2024, 2:16pm UTC](https://meta.discourse.org/t/how-to-display-user-first-name-as-username/296769/8 "2024-02-27T14:16:20Z")

</div>

It’s unclear to me. Is the end goal to _display_ the first name regardless of how the username is created, or do you still also want the username to be created with only the first name?

If the former, you can visually make changes with a theme component to see only the first name in place where the username is displayed (assuming name has this format “firstname lastname”). Would that work for you?

eg:  
from  
 ![image](https://global.discourse-cdn.com/meta/original/4X/6/1/3/6132ff02b7991cb45420147681c1cdcf439dc8b0.png)  
to  
 ![image](https://global.discourse-cdn.com/meta/original/4X/e/7/8/e786f6a4a0f9c7571f43f06e63251592c116274e.png)

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [February 27, 2024, 2:19pm UTC](https://meta.discourse.org/t/how-to-display-user-first-name-as-username/296769/9 "2024-02-27T14:19:55Z")

</div>

> [@Celso\_Teixeira](#):
>
> we employ a Single Sign-On (SSO) mechanism for login, and users don’t have permission to update their usernames.

Then your SSO system is responsible for assigning usernames. It’s what is generating usernames, not discourse, right?

---

<div class="post-metadata">

### Author: ![Celso\_Teixeira](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/celso_teixeira/32/355969_2.png) [@Celso\_Teixeira](https://meta.discourse.org/u/Celso_Teixeira)
#### Post date: [February 27, 2024, 2:20pm UTC](https://meta.discourse.org/t/how-to-display-user-first-name-as-username/296769/10 "2024-02-27T14:20:19Z")

</div>

yes, that would work for me

> [@Arkshine](#):
>
> If the former, you can visually make changes with a theme component to see only the first name in place where the username is displayed (assuming name has this format “firstname lastname”). Would that work for you?

How I can implement this?

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [February 27, 2024, 2:20pm UTC](https://meta.discourse.org/t/how-to-display-user-first-name-as-username/296769/11 "2024-02-27T14:20:28Z")

</div>

Yes, but then it is not anymore plain first name.

---

<div class="post-metadata">

### Author: ![Celso\_Teixeira](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/celso_teixeira/32/355969_2.png) [@Celso\_Teixeira](https://meta.discourse.org/u/Celso_Teixeira)
#### Post date: [February 27, 2024, 2:22pm UTC](https://meta.discourse.org/t/how-to-display-user-first-name-as-username/296769/12 "2024-02-27T14:22:45Z")

</div>

I think is discourse. I’m following the rules created here: [FEATURE: Optionally skip using real name when suggesting usernames by davidtaylorhq · Pull Request #16592 · discourse/discourse · GitHub](https://github.com/discourse/discourse/pull/16592)

---

<div class="post-metadata">

### Author: ![Celso\_Teixeira](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/celso_teixeira/32/355969_2.png) [@Celso\_Teixeira](https://meta.discourse.org/u/Celso_Teixeira)
#### Post date: [February 27, 2024, 2:24pm UTC](https://meta.discourse.org/t/how-to-display-user-first-name-as-username/296769/13 "2024-02-27T14:24:35Z")

</div>

yes, you’re right, it’s not.  
For now, it works for our use case.

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [February 27, 2024, 2:26pm UTC](https://meta.discourse.org/t/how-to-display-user-first-name-as-username/296769/14 "2024-02-27T14:26:23Z")

</div>

I can make you a small component later. 👍
