Set message button text based on the PM's recipients

Hello, I apologize in advance if my question seems stupid.
Is it possible to include settings in the link to change the text of the button to send a message to a specific user or does this need to be configured via CSS? That is, I want the name of the “Message” button to remain for all personal messages in the composer, with the exception of personal messages to forum moderators, where instead of the “Message” button there will be a “Help” button. I know that you can change the name of the buttons for all private messages or buttons for creating topics depending on the category through the admin panel, but I don’t know how to change the name of the “Message” button only in relation to a specific user.

1 Like

What might work for you is to add two reply templates. For example:

[wrap=template key="message-sally" action="create_pm" usernames="sally" title="Hi Sally!" label="Send Sally a PM"]
- [ ] task 1
- [ ] task 2
[/wrap]

[wrap=template key="message-help" action="create_pm" usernames="simon" title="Please help!" label="Get Help"]
- [ ] task 1
- [ ] task 2
[/wrap]

Let me know if I am misunderstanding what you are trying to do.

While looking at this topic’s OP, I noticed that it says username can be used as an option. The correct name for the option is usernames (with an s.) I’ll update the topic to fix that.

3 Likes

Hello! Thanks, but these commands open composer for either a private message or to create a public message. In my case, I would like to change the button name from “Message” to “Help” already in open composer.
I want to change this button for a personal letter to a specific user (for PMs to other users the standard “Message” inscription should remain):

P/s. I have a second question that I posted here. Can you help in any way?

1 Like

@simon for example, I’m a regular user.

  1. I want to write a personal message to the same ordinary user. When you click on a link with a Reply template that opens the composer (editor) for editing the text, there should be a “Message” button at the bottom.
  2. If I want to write to a community moderator asking for help and I click a special link Reply template, which opens a letter to a specific moderator, then at the bottom of the opened composer there should already be a button, for example, “Please help”

Thanks! I think I understand now. I was thrown off because this topic is about the Reply Template theme component. I’ll move these posts to a new topic.

I can think of three ways that a message to a moderator could be initiated: a user could click the Message button from the moderator’s group page, a user could click on a moderator’s avatar and then click the Message button from their user card, or a user could start a new Message from their personal messages page, then add a moderator’s name or the moderators group to the PM’s recipients list.

For messaging an individual user, a user could either click their avatar and click the Message button from the user card, or they could start a new PM from their personal messages page and add the username to the PM’s recipients list.

I think that what you are wanting to do is update the Message button’s text dynamically, depending on the message’s recipient. It might be possible to do this using Javascript in a theme component. I don’t think it will be possible to change the text with CSS.

You could check to see if you can make the changes you are looking for from your site’s Admin / Customize / Text section, but I think the same translation keys are used for all PMs (composer.create_pm).

2 Likes

Yes, you are right, the same composer.create_pm keys are used for all private messages

I would not like the user to have to look for a button to send a message. I would like users to use a reply template to send a private message, which quickly opens the message composer.

1 Like

Should this be feasible, I would prefer to remunerate for the service, given that I am not a software engineer. Presumably, I ought to broach this subject on…marketplace :thinking:

3 Likes

I think that it should be possible to set up an action that would change the button text depending on the user, though I’m not sure just how hard it would be. Posting in marketplace is a fine idea.

3 Likes