# Add %{name} variable to BCC plugin

**URL:** https://meta.discourse.org/t/add-name-variable-to-bcc-plugin/186861
**Category:** Feature
**Tags:** bcc, completed
**Created:** [April 14, 2021, 8:59pm UTC](https://meta.discourse.org/t/add-name-variable-to-bcc-plugin/186861 "2021-04-14T20:59:37Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [April 14, 2021, 8:59pm UTC](https://meta.discourse.org/t/add-name-variable-to-bcc-plugin/186861/1 "2021-04-14T20:59:37Z")

</div>

This is for the [official Bcc plugin](https://meta.discourse.org/t/discourse-bcc-send-individual-pms-to-users/134721).

### Suggestion 1

Could we please have `{name}` as well as `{username}`? Using a real name is a _lot_ more personal in forums where that is acceptable.

### Suggestion 2

Have you considered bringing the UX/sentax in line with the (also official) [Discourse Canned Replies](https://meta.discourse.org/t/discourse-canned-replies/48296) plugin? For example, using the following instead of `{username}` and `{@username}`:

1. `%{username}`
2. `%{@username}`

and if applying my first suggestion:

1. `%{name}`

Cc @Qursch

---

<div class="post-metadata">

### Author: ![Qursch](https://avatars.discourse-cdn.com/v4/letter/q/c37758/32.png) [@Qursch](https://meta.discourse.org/u/Qursch)
#### Post date: [April 16, 2021, 6:38pm UTC](https://meta.discourse.org/t/add-name-variable-to-bcc-plugin/186861/2 "2021-04-16T18:38:00Z")

</div>

These both sound like good suggestions. I’ll start working on them this weekend.  
Edit: PR was created.

[https://github.com/discourse/discourse-bcc/pull/9](https://github.com/discourse/discourse-bcc/pull/9)

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [May 5, 2021, 4:55am UTC](https://meta.discourse.org/t/add-name-variable-to-bcc-plugin/186861/3 "2021-05-05T04:55:58Z")

</div>

Good stuff! But on testing I’ve noticed that the old problem has recurred and we have the name of the first recipient appearing in all subsequent messages - yikes! It is the same as:

> [@Bcc plugin placeholders not working](https://meta.discourse.org/t/bcc-plugin-placeholders-not-working/184787):
>
> The Discourse-bcc plugin’s new feature has a glitch. When I write this message from the user NathanK to my two test users, the placeholder only seems to work on the first user: This is what I get for the first user, which is sweet: However, this is what I get for the second user (note that the username is the first user’s):

I must be the only one actually using this feature at the mo!!

---

<div class="post-metadata">

### Author: ![Qursch](https://avatars.discourse-cdn.com/v4/letter/q/c37758/32.png) [@Qursch](https://meta.discourse.org/u/Qursch)
#### Post date: [May 5, 2021, 5:31pm UTC](https://meta.discourse.org/t/add-name-variable-to-bcc-plugin/186861/4 "2021-05-05T17:31:42Z")

</div>

Just created a PR with what seems to be the fix, but I am unsure of why adding name personalization would break this as it was working before.

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [May 5, 2021, 7:07pm UTC](https://meta.discourse.org/t/add-name-variable-to-bcc-plugin/186861/5 "2021-05-05T19:07:39Z")

</div>

You are awesome! I’ll kick the tires once it is merged.

Hey, I realised something else that was wrong with my `Name` suggestion above - we actually need `Firstname`. Do you reckon it is possible to just use the first word of the string?

I could do that in Excel but no idea in Ruby!!!

---

<div class="post-metadata">

### Author: ![Qursch](https://avatars.discourse-cdn.com/v4/letter/q/c37758/32.png) [@Qursch](https://meta.discourse.org/u/Qursch)
#### Post date: [May 5, 2021, 7:11pm UTC](https://meta.discourse.org/t/add-name-variable-to-bcc-plugin/186861/6 "2021-05-05T19:11:42Z")

</div>

Thanks, just trying to conrtibute where I can. I’ll actually add additional options for `%{first_name}` and `%{last_name}`, and change the existing to be full name.

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [May 11, 2021, 12:20am UTC](https://meta.discourse.org/t/add-name-variable-to-bcc-plugin/186861/7 "2021-05-11T00:20:03Z")

</div>

How did you get on?

From [Fix personalization (#11) · discourse/discourse-bcc@74442fd · GitHub](https://github.com/discourse/discourse-bcc/commit/74442fdec4d21747062daea5cf7e478209a76cc8) it looks like the `%{first_name}` thing didn’t fly but you have fixed the bug.

P.S. do you like my nice `Bug Reporter` title? They say that imitation is the highest form of flattery!

---

<div class="post-metadata">

### Author: ![Qursch](https://avatars.discourse-cdn.com/v4/letter/q/c37758/32.png) [@Qursch](https://meta.discourse.org/u/Qursch)
#### Post date: [May 11, 2021, 12:44am UTC](https://meta.discourse.org/t/add-name-variable-to-bcc-plugin/186861/8 "2021-05-11T00:44:13Z")

</div>

Yeah, the bug should be fixed (I tested it repeatedly). In regards to first and last names, there can be no “one method fits all” as Discourse doesn’t have a separate field for first and last names, only one overall.

---

<div class="post-metadata">

### Author: ![nathank](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/nathank/32/290039_2.png) [@nathank](https://meta.discourse.org/u/nathank)
#### Post date: [May 11, 2021, 1:55am UTC](https://meta.discourse.org/t/add-name-variable-to-bcc-plugin/186861/9 "2021-05-11T01:55:38Z")

</div>

Great work!!! 👍

![Mr Bean Thumbs Up GIF](https://global.discourse-cdn.com/meta/original/3X/b/4/b4814fb9b69f00509ef0db5e48b0f68c714e2a52.webp)

(not so sure that Gifs in Discourse is a great idea but saw it and couldn’t resist)

> [@Qursch](#):
>
> Discourse doesn’t have a separate field for first and last names, only one overall.

Yeah I know - it would require some clever code to split the string if it contained a space, only retaining the characters up until the space. And just using the whole string if there is no space.

Like I said, I can do that in Excel but not Javascript / Ruby!

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [March 2, 2024, 12:45pm UTC](https://meta.discourse.org/t/add-name-variable-to-bcc-plugin/186861/10 "2024-03-02T12:45:08Z")

</div>


