XF 2.0 Action on thread reply?

We're attempting to add an action when creating and replying to threads, and Xen is a new system for us so we're floundering a bit. We've read through the documentation and that doesn't really help in figuring out where to do this.

I want to have a simple checkbox that, when checked, inserts a random value into the database when the user posts. The problem is I'm not sure where I should hook in to insert this value when the user selects to post. What actually handles the saving / what would I extend to add in one extra value at a reply?
 

Attachments

  • Capture.webp
    Capture.webp
    7.6 KB · Views: 19
Action that is triggered when someone replies to post is actionAddReply() that you can find in src/XF/Pub/Controller/Thread.php. On success it runs finalizeThreadReply() that you can use to add custom stuff.

Create custom add-on, extend that class, add custom finalizeThreadReply that calls parent's finalizeThreadReply and does your stuff.
 
Back
Top Bottom