Add a "Personal Message" button on Post

Do you think it is possible to add a “Private Message” button to the topic first post? :thinking:

I am surprised that many users don’t know how to send PM to OP, because the PM button is not visible unless they click on the OP’s avatar.

For example,


Currently, I am using the " discourse-custom-topic-button" plugin.

And use the url of
example.com/new-message?username=<TOPIC_USERNAME>&title=Re:<TOPIC_TITLE>

However, when user click on the button, it jump to the front page immediately, before the Message editor show up. It doesn’t act the same as the “Message” button in user card. If you click on the “Message” button in user card, it show up the message editor immediate without jumping to other page.

Do you think it is possible to make the custom button (new-message url) act the same as the Message button in user card ? :thinking:

I recently built this for a client:

https://github.com/paviliondev/discourse-pm-topic-author

It is open-source. It may suit your needs. Just add the Categories you want it to appear in. Let me know if you hit any bugs.

Unfortunately I don’t have time to extend it at present.

Thanks to @davidkingham for commissioning us to do the work and allowing this to be open source, and in turn therefore supporting the wider community.

10 Likes

Thank you very much. :smiling_face_with_three_hearts: :smiling_face_with_three_hearts: :smiling_face_with_three_hearts:

It works exactly what I am looking for. :partying_face: :partying_face: :partying_face:


Just out of curiosity, :grinning:

Do you think I can add
{{#if this.user.can_send_private_message_to_user}}
to “pm-topic-author.hbs” , so that the button won’t show up if the user is the same as the OP ? :thinking:

Similar to Discourse User card “user-card-contents.hbs

pm-topic-author.hbs

3 Likes

Good catch!

Given we already have the showPMTopicAuthorButton property, we should probably do that in JS, though your solution is a great interim approach.

3 Likes

So I’ve done that with JS:

https://github.com/paviliondev/discourse-pm-topic-author/commit/a82ac238d9dce2291e827b66784aef1715e077c0

Thanks for your feedback.

Upgrade when you get chance and please confirm that works for you.

10 Likes

Thank you very much for the update. :smiling_face_with_three_hearts: :smiling_face_with_three_hearts: :smiling_face_with_three_hearts:

Now It works perfectly well for login user. :partying_face: :partying_face: :partying_face:

However, it seem after updated, the plugin cause some error for non-login user. When non-login user visit the page, it get a blank post. It only show the title, category, tag, but everything below is empty . :thinking:

Browser Inspector:
2021-04-11_053333

Error log:

1 Like

https://github.com/paviliondev/discourse-pm-topic-author/commit/ed5a0128c754e1017a752a08bf3725acf3f5bfb5
Schoolboy error :man_facepalming:t3:- introduced that in last change. Hopefully that resolves it for you :slight_smile:

4 Likes

You already have it here in the composer, click on the reply arrow at upper left, like so, then select New Message.

image

Hello, I can see that you now maintain this plugin on github?

I’ve installed the plugin but it doesn’t seem to work. Firstly the on button is greyed on Plugins page, see below. Not sure what it means?

Next, setting values doesn’t show button next to user’s name.

Does this plugin still work? Can we make it work?

Hello,
I want to add Send Message button next to user’s name on the posts like shown below:

I’ve been reading various posts related to this feature but none of them seem to satisfy my requirements.

I’ve read this but this points to theme component which add button at the bottom of topic.

Any ideas how to achieve this?

It doesn’t look like there’s a plugin outlet to put the button exactly where you want:

Maybe you could settle for having it at topic-above-posts.

Then you’d make a glimmer component that adds the button. Finally, you’d use api.renderInOutlet to have that component show up there. Custom Components -- add button or text at any plugin outlet is an example of that.

So then you’d modify this:

and just figure out the URL to start that message (Prefilled composer link generator might help – you just need to know what link you want).

3 Likes

Thanks for the reply. It is beyond my capabilities.
There was a plugin for this exact requirements, seems to have been scraped Add a "Personal Message" button on Post this is what I was looking for.

Hi Sally! I’m wondering why you would want to do this. Don’t you want your members to reply to the topic to have a conversation together? Adding a link like that will also clutter the interface and distract your members.

Why is it not enough for you that, when you click on the avatar/username, you can see a usercard pop up which has the button to send the member a message directly?

3 Likes

I’m trying to build a messaging system where users can post in the forum but the main feature is sending messages to each other. So I want Message button to be visible. Any new user will take time to figure out how to send message.

1 Like

That’s an interesting use of Discourse! You might get by just doing more to educate your members how to access the user card to reply via personal message (or chat? are you also using chat?). You could create a persistent banner across the top, for instance. And explain how to access it in your welcome message.

If you absolutely need this button and you have a budget, you could post to Marketplace and maybe someone here can build it for you.

I’ve already done that, showing at the top, sending instructions in welcome message, about us page and so on.

Not using chat, messages will do for me.

Yes, that would be last resort.

I wish someone could revive this plugin as it did work in the past, didn’t it?

I’m the original author. Even if it still worked the plugin just adds the button to the first Post not every Post.

3 Likes

Hi Robert, Yes that’s exactly what I want, to add the Message button next to OP’s first post.

The problem is that plugin doesn’t work, it doesn’t show Message button. I’ve installed it. I can see that the On button is greyed on Plugins page for this plugin, not sure what that means?

Would you be able to revive this plugin? Please? If you get some free time.

Actually, my custom components theme component would work.

Just put on the url to start a pm (I think that works?) and the plugin outlet I mentioned above in the settings.

Edit:

Oh. Darn.

No. You need this

 https://your.discourse.site/new-message?username=username

And there is no mechanism to include the topic username

If you have budget and would like to Sponsor the work, PM me.

2 Likes