Add %{name} variable to BCC plugin

This is for the official Bcc plugin.

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 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

3 Likes

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

2 Likes

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:

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

2 Likes

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.

2 Likes

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!!!

1 Like

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.

2 Likes

How did you get on?

From Fix personalization (#11) · discourse/discourse-bcc@74442fd · GitHub 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!

1 Like

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.

Great work!!! :+1:

Mr Bean Thumbs Up GIF

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

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!

1 Like