Writing an extension to send a PM when "like" is clicked


Well-known member
Someone on another forum said:
There is a psychology to rep systems. On forums like this ..., it's hugely popular, for distinct reasons.

Everytime you give someone a point of rep it instantly opens up a field to send a message to someone. Thank you note, quick box of chocolates, etc...the thing is that it's fast and instantly transforms the normal rep giver into a potentially thoughtful gift giver.

The messages mean something because they show accolades and thanks to people for the quality and impact a post made on the forum has made to someone. ...

As well, the messages can be collected. An admin here a few years ago posted about "the warm fuzzy feeling"

That's what you get when you receive a simple thank you note like that, and it slowly builds a feeling of satisfaction into a user's experience in a community like this where insightful feedback and experienced answers all tie in.

People love to collect, and building quality posts by giving people feedback and good feelings with collected thank you notes has impact.

Maybe we can compare these collected thank you notes to something like Olympic medals? ...

If it can build and make a community feel better about helping each other this becomes a powerful tool.
In the process of researching our forum purchase, I came across the above quote on another admin forum and instantly realized that this is exactly what we need.

Our community is a support community for people with intense long term chronic pain. It's pretty intense, and experienced members take time out of their busy schedules to support newer members. A system that transforms a "like" into an opportunity to send a message to the author of the liked post would be a big deal of our forums. It would make posting much more gratifying for the experienced members, increase retention of those same members, and ensure that people got better support.

How would one go about modifying XenForo to have something where if one clicked on "like," a field popped up that prompted you to send a PM to the person to thank them?

I ask this because, whatever forum software we go with, I plan to get pretty deep into the innards, writing extensions. I've already gotten pretty deep into our MediaWiki installation, writing extensions in PHP, and expect to do the same, only more so, in the forum. (The natural experience is, "do I have experience with Javascript and jQuery. I don't, but I've written a bunch in C and other languages, so while I know a lot is involved, I'm not going to let that stop me. I figure that when there's a will there is a way. After all, people probably said that it was impossible for a small startup to take on the vBs and IPBs of the world... ;) )

Given the above, before we make our final purchase decision, I'd like to get a sense of what it's like to write extensions for the various platforms we are considering. The only way to really get a feel for a software framework is to dig in and start designing software in it, so in addition to asking this question because I want to make that particular extension, I also want to seriously investigate how I'd write this thing, so I can get a feel for the platform. Hence, please go into as much detail as you are willing about which hooks I'd want to listen for and which tutorials or open source projects I'd want to look at.

I'm a bit apprehensive particularly with XenForo because of the JavaScript and jQuery, so, since I've brought all of this up, I'd certainly love to hear what people have to say about how it affects writing extensions for XF.

Thanks in advance for reading this far and any feedback you can give.


Well-known member
An example of what I'm describing can be found at "TheAdminZone:"

Next to the post number for every post is a set of scales. You click on these scales to give Karma and when you do, a little popup appears:
Add to Karma: Nev_Dull
What do you think of Nev_Dull's post?
Good! Karma++
Your comments on this post:

There are two things that I really love about this. First, it feels like a complement to the person rather than just to the post. That feels more meaningful and, frankly, more motivational (key).

The second is that in a very innocuous and low pressure way it prompts you to send a little note.

Any thoughts on how to write an addon to do this in XF?

Jake Bunce

XenForo moderator
Staff member
You will need to extend this function:


That is the controller that handles the request when some one clicks the "Like" link in a post. It can be extended to handle additional input such as a "thank you" note. If you want to send the note as a PM then you would invoke XenForo_DataWriter_ConversationMaster inside of your extended function. You can see an example of using this datawriter if you look in XenForo_ControllerPublic_Conversation.

Here is a tutorial for extending controllers:


If you extend an existing controller then you can use the same function name as the original controller to extend that action.